forked from flintlib/python-flint
-
Notifications
You must be signed in to change notification settings - Fork 0
482 lines (426 loc) · 15.6 KB
/
buildwheel.yml
File metadata and controls
482 lines (426 loc) · 15.6 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
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
name: Build
on: [push, pull_request]
env:
# These four values need to be kept in sync. Each pyodide version pins an
# emscripten version and a CPython version.
PYODIDE_VERSION: '0.29.3'
PYODIDE_EMSCRIPTEN_VERSION: '4.0.9'
PYODIDE_PYTHON_VERSION: '3.13'
PYODIDE_CIBW_BUILD: 'cp313-*'
jobs:
build_wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- name: Build manylinux x86-64 wheels
os: ubuntu-22.04
kind: native
artifact_name: wheels-ubuntu-22.04
cibw_platform: auto
cibw_build: "*"
- name: Build manylinux arm64 wheels
os: ubuntu-22.04-arm
kind: native
artifact_name: wheels-ubuntu-22.04-arm
cibw_platform: auto
cibw_build: "*"
- name: Build Windows x86-64 wheels
os: windows-2022
kind: native
artifact_name: wheels-windows-2022
cibw_platform: auto
cibw_build: "*"
- name: Build Windows arm64 wheels
os: windows-11-arm
kind: native
artifact_name: wheels-windows-11-arm
cibw_platform: auto
cibw_build: "*"
- name: Build macOS x86-64 wheels
os: macos-15-intel
kind: native
artifact_name: wheels-macos-15-intel
cibw_platform: auto
cibw_build: "*"
- name: Build macOS arm64 wheels
os: macos-14
kind: native
artifact_name: wheels-macos-14
cibw_platform: auto
cibw_build: "*"
- name: Build Pyodide wheels
os: ubuntu-22.04
kind: pyodide
artifact_name: wheels-pyodide
cibw_platform: pyodide
steps:
- uses: actions/checkout@v6.0.2
- if: ${{ matrix.kind == 'native' }}
uses: actions/setup-python@v6
with:
python-version: '3.13'
# -------------- Windows stuff ---------------- #
- if: ${{ matrix.os == 'windows-2022' }}
uses: msys2/setup-msys2@v2.30.0
with:
msystem: ucrt64
update: true
- if: ${{ matrix.os == 'windows-11-arm' }}
uses: msys2/setup-msys2@v2.30.0
with:
msystem: clangarm64
update: true
# Install pkgconfig on Windows from choco rather than from msys and
# avoid using the Strawberry one.
- if: ${{ startsWith( matrix.os , 'windows' ) }}
run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
# We have to set this here rather than in the cibuildwheel config
# This is probably something to do with \ vs / in paths...
- if: ${{ startsWith( matrix.os , 'windows' ) }}
run: |
$pkgConfigPath = "${{ github.workspace }}/.local/lib/pkgconfig"
$pkgConfigPath = $pkgConfigPath.Replace('\', '/')
echo "PKG_CONFIG_PATH=$pkgConfigPath" >> $env:GITHUB_ENV
# ------------- pyodide ------------- #
- if: ${{ matrix.kind == 'pyodide' }}
name: Set up Emscripten toolchain
uses: pyodide/setup-emsdk@ca2dd8aef8c2a0e11743c5c36f0b430ddb694b5c # v15
with:
version: ${{ env.PYODIDE_EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache
- if: ${{ matrix.kind == 'pyodide' }}
name: Check out Emscripten patches for Pyodide
uses: actions/checkout@v6.0.2
with:
repository: pyodide/pyodide
ref: ${{ env.PYODIDE_VERSION }}
path: pyodide-patches
sparse-checkout: |
emsdk/patches/
# ------------- actual build ------------- #
- name: Build wheels
uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
env:
CIBW_PLATFORM: ${{ matrix.cibw_platform }}
CIBW_BUILD: ${{ matrix.kind == 'pyodide' && env.PYODIDE_CIBW_BUILD || matrix.cibw_build }}
CIBW_PYODIDE_VERSION: ${{ env.PYODIDE_VERSION }}
# override setting in pyproject.toml to use msys2 instead of msys64 bash
CIBW_BEFORE_ALL_WINDOWS: ${{ matrix.os == 'windows-11-arm' && 'msys2 -c bin/cibw_before_all_windows_arm64.sh' || 'msys2 -c bin/cibw_before_all_windows_amd64.sh' }}
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: wheelhouse/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYODIDE_PYTHON_VERSION }}
- run: bin/install_latest_flint_ubuntu.sh
- run: pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
test_wheels:
needs: build_wheels
name: Test ${{ matrix.python-version }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [
ubuntu-22.04,
ubuntu-24.04,
ubuntu-24.04-arm,
windows-2022,
windows-2025,
windows-11-arm,
macos-15-intel,
macos-14,
macos-15,
]
# This list to be kept in sync with python-requires in pyproject.toml.
python-version: ['3.11', '3.12', '3.13', '3.13t', '3.14', '3.14t', 'pypy3.11']
exclude:
- os: windows-11-arm
python-version: pypy3.11
steps:
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: actions/download-artifact@v8
with:
path: wheelhouse
merge-multiple: true
- run: pip install --no-index --find-links wheelhouse python_flint
# Check if the GIL is disabled in the free-threading build after import.
- run: |
python --version --version
which python
python -c "import sysconfig; print(sysconfig.get_config_var('Py_GIL_DISABLED'))"
python -c "import sys; print(getattr(sys, '_is_gil_enabled', lambda: True)())"
python -c "import sys; import flint; print(getattr(sys, '_is_gil_enabled', lambda: True)())"
- run: python -m flint.test --verbose
test_pyodide:
needs: build_wheels
name: Test Pyodide wheel
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYODIDE_PYTHON_VERSION }}
- uses: actions/setup-node@v6
with:
node-version: '22'
- run: pip install pyodide-build
- run: pyodide xbuildenv install "${{ env.PYODIDE_VERSION }}"
- uses: actions/download-artifact@v8
with:
name: wheels-pyodide
path: wheelhouse
- run: |
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
pip install wheelhouse/*.whl
pip install pytest hypothesis
python -m pytest -svra -p no:cacheprovider --pyargs flint
# On new enough Ubuntu we can build against the system deb.
test_pip_flint_deb:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: python -m flint.test --verbose
test_docs:
name: Test docs (build and doctest)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: bin/install_latest_flint_ubuntu.sh
- run: pip install --upgrade pip
- run: pip install -r requirements-dev.txt
- run: spin run -- pytest --doctest-glob='*.rst' doc/source
- run: spin docs
# Test build with minimum Cython and meson-python versions.
test_old_build_requires:
name: 'Test old Cython/meson-python'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
# The versions of cython and meson-python here should be kept in sync
# with those in pyproject.toml so that we test the stated minimum
# versions.
#
# We don't need to specify ninja as a requirement in pyproject.toml
# because without --no-build-isolation meson-python handles it
# automatically in get_requirements_for_build_wheel().
- run: 'pip install "cython==3.0.11" "meson-python==0.18" "ninja<1.11"'
- run: pip install --no-build-isolation .
- run: python -m flint.test --verbose
# For older Ubuntu we have to build Flint >= 3.0.0
test_flint_releases:
name: Test flint ${{ matrix.flint-tag }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# Supported Flint versions:
flint-tag: ['v3.0.1', 'v3.1.3-p1', 'v3.2.2', 'v3.3.1']
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: bin/install_flint_ubuntu.sh ${{ matrix.flint-tag }}
- run: pip install .
- run: python -m flint.test --verbose
# Test against flint main
test_flint_main:
name: Test flint main Linux x86-64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: bin/install_flint_ubuntu.sh main
# Need to disable flint version check to build against main
- run: pip install --config-settings=setup-args="-Dflint_version_check=false" .
- run: python -m flint.test --verbose
# Test against flint main
test_flint_main_arm:
name: Test flint main Linux ARM
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: bin/install_flint_ubuntu.sh main
# Need to disable flint version check to build against main
- run: pip install --config-settings=setup-args="-Dflint_version_check=false" .
- run: python -m flint.test --verbose
# Test that we can make a coverage build and report coverage
test_coverage_build_setuptools:
name: Test coverage setuptools build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install -r requirements-dev.txt
- run: bin/coverage_setuptools.sh
# Test that we can make a coverage build and report coverage
test_coverage_build_meson:
name: Test coverage meson build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.12' # does not work with 3.13
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install -r requirements-dev.txt
- run: bin/coverage.sh
# Run SymPy test suite against python-flint master
test_sympy:
name: Test SymPy ${{ matrix.sympy-version }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
sympy-version: ['1.13.1', '1.14.0']
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: pip install pytest pytest-xdist hypothesis
- run: pip install sympy==${{ matrix.sympy-version }}
- run: python -c 'import sympy; sympy.test(parallel=True)'
# Run SymPy master branch agains python-flint main
test_sympy_master:
name: Test SymPy master
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: pip install pytest pytest-xdist hypothesis
- run: pip install git+https://github.com/sympy/sympy.git@master
- run: python -c 'import sympy; sympy.test(parallel=True)'
# Push nightly wheels to Anaconda scientific-python nightly channel
# https://scientific-python.org/specs/spec-0004/
# https://anaconda.org/scientific-python-nightly-wheels/python-flint
# https://github.com/scientific-python/upload-nightly-action/issues/111
nightly-wheels-upload:
name: Upload Anaconda Scientific Python nightly wheels
needs: [build_wheels]
# Run on push/merge to main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
# Downloads all artifacts
- name: Download release artifacts
uses: actions/download-artifact@v8
with:
path: wheelhouse
merge-multiple: true
- name: Copy the wheels into dist
run: mkdir dist && cp wheelhouse/*.whl dist
- name: Upload wheels
uses: scientific-python/upload-nightly-action@5748273c71e2d8d3a61f3a11a16421c8954f9ecf # 0.6.3
with:
artifacts_path: dist
# This token is generated from anaconda.org
# https://github.com/scientific-python/upload-nightly-action/issues/111
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
# Deploy wheels and sdist to PyPI
pypi_release:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
# Run only when a tag is pushed to the flintlib/python-flint repo
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository_owner == 'flintlib'"
environment:
name: pypi
url: https://pypi.org/p/python-flint
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
# Downloads all artifacts
- name: Download release artifacts
uses: actions/download-artifact@v8
with:
path: wheelhouse
merge-multiple: true
- name: Copy the PyPI files into dist
# pyodide wheels cannot be uploaded to PyPI
run: |
mkdir dist
rm wheelhouse/*pyodide*.whl
cp wheelhouse/*.whl wheelhouse/*.tar.gz dist
- name: Publish package on PyPI
# It is recommended to pin a commit hash here for security but it
# should be kept up to date. Possibly all actions and dependencies used
# by the build script should be pinned...
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
# Make a GitHub release
github-publish:
name: Publish GitHub release
needs: pypi_release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6.0.2
- name: Download sdist
uses: actions/download-artifact@v8
with:
name: sdist
path: dist
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: >
gh release create ${{ github.ref_name }} dist/*
--title "python-flint ${{ github.ref_name }}"
--notes "https://github.com/flintlib/python-flint?tab=readme-ov-file#changelog"