-
Notifications
You must be signed in to change notification settings - Fork 327
198 lines (177 loc) · 5.87 KB
/
build_wrapper.yaml
File metadata and controls
198 lines (177 loc) · 5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Multiplatform build of libuuu wrapper python package
on:
push:
branches: [master]
tags: [uuu*]
pull_request:
types: [opened, synchronize]
jobs:
build-wheels:
name: Build libuuu for ${{ matrix.os }} on ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
arch: x86_64
cibw_archs: AMD64 x86
build_script: .\.github\scripts\build_windows.bat
- os: ubuntu-22.04
arch: x86_64
cibw_archs: x86_64
build_script: .github/scripts/build_linux.sh x86_64
- os: ubuntu-22.04-arm
arch: aarch64
cibw_archs: aarch64
build_script: .github/scripts/build_linux.sh aarch64
- os: macos-latest
arch: x86_64
cibw_archs: x86_64
build_script: .github/scripts/build_macos.sh x86_64
- os: macos-latest
arch: arm64
cibw_archs: arm64
build_script: .github/scripts/build_macos.sh arm64
permissions:
id-token: write
contents: read
steps:
- name: Set up QEMU
if: runner.os == 'Linux' && runner.arch == 'X64'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: false
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Validate git versioning (Windows)
if: runner.os == 'Windows'
run: |
$version = git describe --tags --long 2>$null
if ($LASTEXITCODE -ne 0) {
Write-Host "Error: No git tags found. Cannot determine version."
Write-Host "Available tags:"
git tag -l
exit 1
}
Write-Host "Found version: $version"
- name: Validate git versioning (Unix)
if: runner.os != 'Windows'
run: |
if ! version=$(git describe --tags --long 2>/dev/null); then
echo "Error: No git tags found. Cannot determine version."
echo "Available tags:"
git tag -l
exit 1
fi
echo "Found version: $version"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build cibuildwheel
- name: Build wheels with cibuildwheel
run: python -m cibuildwheel ./wrapper --output-dir outputs
env:
CIBW_BUILD: cp39-*
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs }}
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs }}
CIBW_SKIP: "*-musllinux*"
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64
CIBW_BEFORE_ALL: ${{ matrix.build_script }}
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair -w {dest_dir} {wheel}"
CIBW_TEST_COMMAND: "pytest {project}/wrapper/tests"
MACOSX_DEPLOYMENT_TARGET: 11.0
CIBW_BUILD_VERBOSITY: 1
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: ./outputs/*.whl
- name: Upload shared libraries
uses: actions/upload-artifact@v4
with:
name: libs-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ contains(matrix.os, 'ubuntu') && './outputs/libuuu/lib' || './wrapper/libuuu/lib' }}
build-sdist:
name: Build source distribution of libuuu wrapper
runs-on: ubuntu-latest
needs: build-wheels
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: false
- name: Download shared libraries
uses: actions/download-artifact@v4
with:
pattern: libs-*
path: ./wrapper/libuuu/lib
merge-multiple: true
- name: Print shared libraries
run: find ./wrapper/libuuu/lib
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U build nxp-codecheck colorama setuptools_scm
- name: Build source distribution
working-directory: ./wrapper
run: python -m build --sdist
- name: Upload source distribution
uses: actions/upload-artifact@v4
with:
name: sdist-libuuu
path: ./wrapper/dist/*.tar.gz
- name: Run codecheck
working-directory: ./wrapper
run: |
codecheck --version
codecheck -s
- name: Upload reports if codecheck fails
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports-codecheck
path: ./wrapper/reports/*
publish-pypi:
name: Publish to PyPI
needs: build-sdist
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment:
name: pypi
url: https://pypi.org/project/libuuu/
if: github.ref_type == 'tag'
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: sdist-libuuu
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
skip-existing: false