-
Notifications
You must be signed in to change notification settings - Fork 27
297 lines (264 loc) · 9.92 KB
/
buildwheel.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
name: Build
on: [push, pull_request]
jobs:
build_wheels:
name: Build wheels for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
# path-type inherit is used so that when cibuildwheel calls msys2 to
# run bin/cibw_before_build_windows.sh the virtual environment
# created by cibuildwheel will be available within msys2. The
# msys2/setup-msys2 README warns that using inherit here can be
# problematic in some situations. Maybe there is a better way to do
# this.
path-type: inherit
if: ${{ matrix.os == 'windows-2019' }}
# Install pkgconfig on Windows from choco rather than from msys and
# avoid using the Strawberry one.
- run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
if: ${{ matrix.os == 'windows-2019' }}
# We have to set this here rather than in the cibuildwheel config
# This is probably something to do with \ vs / in paths...
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV
if: ${{ matrix.os == 'windows-2019' }}
- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
env:
# override setting in pyproject.toml to use msys2 instead of msys64 bash
CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh
#
# Don't need to create pythonXX.a under meson. Not needed any more:
# CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel && msys2 -c bin/cibw_before_build_windows.sh
#
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: sudo apt-get update
- run: sudo apt-get install libgmp-dev libmpfr-dev xz-utils ninja-build
- run: curl -O -L https://www.flintlib.org/flint-3.1.0.tar.gz
- run: tar -xzf flint-3.1.0.tar.gz
- run: cd flint-3.1.0 && ./configure --disable-static && make -j4 && sudo make install
- run: pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
test_rst:
needs: build_wheels
name: Test rst docs
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/download-artifact@v4
with:
name: wheels-ubuntu-20.04
path: wheelhouse
- run: pip install --upgrade pip
- run: pip install pytest
- run: pip install --no-index --find-links wheelhouse python_flint
- run: pytest --doctest-glob='*.rst' doc/source
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-20.04, windows-2019, macos-13, macos-14]
# This list to be kept in sync with cibuildwheel config
# and python-requires in pyproject.toml.
python-version: ['3.10', '3.11', '3.12', '3.13-dev', 'pypy3.10']
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse
- run: pip install --no-index --find-links wheelhouse python_flint
- run: python -m flint.test --verbose
# 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@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: python -m flint.test --verbose
# 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@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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" "meson-python==0.13" "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.0', 'v3.0.1', 'v3.1.0', 'v3.1.1', 'v3.1.2']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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:
name: Test coverage setuptools build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
# Need Cython's master branch until 3.1 is released because of:
# https://github.com/cython/cython/pull/6341
- run: pip install git+https://github.com/cython/cython.git@master
- run: pip install -r requirements-dev.txt
- run: bin/coverage.sh
# On new enough Ubuntu we can build against the system deb.
test_freethreaded:
name: Free-threaded ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
python-version: ['3.13-dev']
steps:
- uses: actions/checkout@v4
# Can't use actions/setup-python
# https://github.com/actions/setup-python/issues/771
# deadsnakes only works for Ubuntu...
- uses: deadsnakes/action@v3.1.0
with:
python-version: ${{ matrix.python-version }}
nogil: true
- run: |
python --version --version
which python
python -c "import sysconfig; print(sysconfig.get_config_var('Py_GIL_DISABLED'))"
python -c "import sys; print(sys._is_gil_enabled())"
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
# Need Cython master until 3.1 is released
- run: pip install git+https://github.com/cython/cython.git@master
- run: pip install -r requirements-dev.txt
- run: pip install --no-build-isolation .
- run: python -m flint.test --verbose
# 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']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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)'
# 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/sympy
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
# Downloads all artifacts
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: wheelhouse
merge-multiple: true
- name: Copy the PyPI files into dist
run: mkdir dist && 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@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0