-
Notifications
You must be signed in to change notification settings - Fork 4
354 lines (297 loc) · 9.53 KB
/
build.yml
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
name: build
# Build on every branch push, tag push, and pull request change.
on:
- push
- pull_request
env:
PYTHON_VER: "3.11" # Python to run test/cibuildwheel
CIBW_BUILD: >
cp312-* cp311-* cp310-* cp39-* cp38-* cp37-* cp36-*
pp310-* pp39-* pp38-* pp37-*
CIBW_TEST_COMMAND: python -m unittest discover {project}/tests
jobs:
test_cpython:
name: Test on ${{ matrix.platform }} ${{ matrix.architecture }} ${{ matrix.build_option }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
build_option:
- "--warning-as-error"
- "--warning-as-error --multi-phase-init"
- "--warning-as-error --cffi"
architecture:
- x64
include:
- platform: windows-latest
build_option: "--warning-as-error"
architecture: x86
- platform: windows-latest
build_option: "--warning-as-error --multi-phase-init"
architecture: x86
- platform: windows-latest
build_option: "--warning-as-error --cffi"
architecture: x86
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
architecture: ${{ matrix.architecture }}
- name: Run test
run: |
python -m pip install cffi
python -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv .
python -m unittest discover tests
test_cpython_debug:
name: Test debug build on Ubuntu ${{ matrix.build_option }}
runs-on: ubuntu-latest
strategy:
matrix:
build_option:
- "--warning-as-error --debug"
- "--warning-as-error --debug --multi-phase-init"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Run test
run: |
sudo apt-get update
sudo apt-get install python3-dbg
sudo python3-dbg -m pip install -U pip
python3-dbg -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv .
python3-dbg -m unittest discover tests
test_pypy:
name: Test on ${{ matrix.py }}
runs-on: ubuntu-latest
strategy:
matrix:
py:
- "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Build & test
run: |
sudo apt-get install -q -y zstd libzstd1 libzstd-dev
python -m pip install --config-settings="--build-option=--dynamic-link-zstd --warning-as-error" -v .
python -m unittest discover tests
# If the head commit message contains '<more-tests>', run test on
# armv6/armv7/aarch64/ppc64le/s390x/riscv64 architectures.
test_arches:
name: Test on ${{ matrix.distro }} ${{ matrix.arch }}
if: github.event_name == 'push' && contains(github.event.head_commit.message, '<more-tests>')
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- armv6
- armv7
- aarch64
- ppc64le
- s390x
distro:
- alpine_latest
include:
- arch: riscv64
distro: alpine_edge
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: uraimo/run-on-arch-action@v2
name: Build & run test
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
install: |
apk update
apk add python3 python3-dev py3-pip build-base gcc
run: |
python3 -m venv pyzstd-venv
. pyzstd-venv/bin/activate
python3 -m pip install --config-settings="--build-option=--warning-as-error" -v .
python3 -m unittest discover tests
build_sdist:
name: Build sdist
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
- name: Build sdist
run: |
python -m pip install -U build
python -m build --sdist
- name: List distributions
run: ls -lR dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Build wheels on ${{ matrix.platform }}
if: startsWith(github.ref, 'refs/tags')
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
env:
CIBW_ARCHS_MACOS: "x86_64 arm64"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
# cibuildwheel and PEP-517 don't work on CPython 3.6. This can
# be removed after cibuildwheel doesn't support CPython 3.6.
- name: Remove pyproject.toml
uses: JesseTG/rm@v1.0.3
with:
path: pyproject.toml
- name: Build wheels
run: |
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: List distributions
run: ls -lR wheelhouse
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.platform }}
path: wheelhouse/*.whl
build_wheels_manylinux2010:
name: Build wheels for manylinux2010
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
env:
# Generate manylinux1_x86_64 wheels.
# tag pip CPython with the pip glibc
# manylinux1 >=8.1.0 3.5.2+, 3.6.0+ 2.5 (2006-09-29)
# manylinux2010 >=19.0 3.7.3+, 3.8.0+ 2.12 (2010-05-03)
# manylinux2014 >=19.3 3.7.8+, 3.8.4+, 3.9.0+ 2.17 (2012-12-25)
# manylinux_x_y >=20.3 3.8.10+, 3.9.5+, 3.10.0+ x.y
# manylinux2010 images EOL on 2022-08-01, it doesn't support cp311/pp39.
CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* cp310-* pp37-* pp38-*
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2010
CIBW_ARCHS_LINUX: x86_64
CIBW_SKIP: "*musllinux*"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
# cibuildwheel and PEP-517 don't work on CPython 3.6. This can
# be removed after cibuildwheel doesn't support CPython 3.6.
- name: Remove pyproject.toml
uses: JesseTG/rm@v1.0.3
with:
path: pyproject.toml
- name: Build wheels
run: |
python -m pip install -U build cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: List distributions
run: ls -lR wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-manylinux2010
path: wheelhouse/*.whl
build_arch_wheels:
name: Build wheels for ${{ matrix.arch }} (skip ${{ matrix.skip_image }})
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- aarch64
- ppc64le
- s390x
# Building in QEMU is very slow, so parallelize the tasks.
skip_image:
- musllinux
- manylinux
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: "*${{ matrix.skip_image }}*"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
# cibuildwheel and PEP-517 don't work on CPython 3.6. This can
# be removed after cibuildwheel doesn't support CPython 3.6.
- name: Remove pyproject.toml
uses: JesseTG/rm@v1.0.3
with:
path: pyproject.toml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build wheels
run: |
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
- name: List distributions
run: ls -lR wheelhouse
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.arch }}-${{ matrix.skip_image }}
path: wheelhouse/*.whl
upload_pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
needs:
- build_sdist
- build_wheels
- build_wheels_manylinux2010
- build_arch_wheels
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write # This permission is mandatory for trusted publishing
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: List distributions
run: ls -lR dist
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
print-hash: true