@@ -2,57 +2,133 @@ name: Build
22
33on : [push, pull_request]
44
5+ env :
6+ # These four values need to be kept in sync. Each pyodide version pins an
7+ # emscripten version and a CPython version.
8+ PYODIDE_VERSION : ' 0.29.3'
9+ PYODIDE_EMSCRIPTEN_VERSION : ' 4.0.9'
10+ PYODIDE_PYTHON_VERSION : ' 3.13'
11+ PYODIDE_CIBW_BUILD : ' cp313-*'
12+
513jobs :
614 build_wheels :
7- name : Build wheels for ${{ matrix.os }}
15+ name : ${{ matrix.name }}
816 runs-on : ${{ matrix.os }}
917 continue-on-error : true
1018 strategy :
1119 fail-fast : false
1220 matrix :
13- os : [ubuntu-22.04, ubuntu-22.04-arm, windows-2022, windows-11-arm, macos-15-intel, macos-14]
21+ include :
22+ - name : Build manylinux x86-64 wheels
23+ os : ubuntu-22.04
24+ kind : native
25+ artifact_name : wheels-ubuntu-22.04
26+ cibw_platform : auto
27+ cibw_build : " *"
28+ - name : Build manylinux arm64 wheels
29+ os : ubuntu-22.04-arm
30+ kind : native
31+ artifact_name : wheels-ubuntu-22.04-arm
32+ cibw_platform : auto
33+ cibw_build : " *"
34+ - name : Build Windows x86-64 wheels
35+ os : windows-2022
36+ kind : native
37+ artifact_name : wheels-windows-2022
38+ cibw_platform : auto
39+ cibw_build : " *"
40+ - name : Build Windows arm64 wheels
41+ os : windows-11-arm
42+ kind : native
43+ artifact_name : wheels-windows-11-arm
44+ cibw_platform : auto
45+ cibw_build : " *"
46+ - name : Build macOS x86-64 wheels
47+ os : macos-15-intel
48+ kind : native
49+ artifact_name : wheels-macos-15-intel
50+ cibw_platform : auto
51+ cibw_build : " *"
52+ - name : Build macOS arm64 wheels
53+ os : macos-14
54+ kind : native
55+ artifact_name : wheels-macos-14
56+ cibw_platform : auto
57+ cibw_build : " *"
58+ - name : Build Pyodide wheels
59+ os : ubuntu-22.04
60+ kind : pyodide
61+ artifact_name : wheels-pyodide
62+ cibw_platform : pyodide
1463
1564 steps :
1665 - uses : actions/checkout@v6.0.2
1766
18- - uses : actions/setup-python@v6
67+ - if : ${{ matrix.kind == 'native' }}
68+ uses : actions/setup-python@v6
1969 with :
2070 python-version : ' 3.13'
2171
22- - uses : msys2/setup-msys2@v2.30.0
72+ # -------------- Windows stuff ---------------- #
73+
74+ - if : ${{ matrix.os == 'windows-2022' }}
75+ uses : msys2/setup-msys2@v2.30.0
2376 with :
2477 msystem : ucrt64
2578 update : true
26- if : ${{ matrix.os == 'windows-2022' }}
2779
28- - uses : msys2/setup-msys2@v2.30.0
80+ - if : ${{ matrix.os == 'windows-11-arm' }}
81+ uses : msys2/setup-msys2@v2.30.0
2982 with :
3083 msystem : clangarm64
3184 update : true
32- if : ${{ matrix.os == 'windows-11-arm' }}
3385
3486 # Install pkgconfig on Windows from choco rather than from msys and
3587 # avoid using the Strawberry one.
36- - run : choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
37- if : ${{ startsWith( matrix.os , 'windows' ) }}
88+ - if : ${{ startsWith( matrix.os , 'windows' ) }}
89+ run : choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
3890
3991 # We have to set this here rather than in the cibuildwheel config
4092 # This is probably something to do with \ vs / in paths...
41- - run : |
93+ - if : ${{ startsWith( matrix.os , 'windows' ) }}
94+ run : |
4295 $pkgConfigPath = "${{ github.workspace }}/.local/lib/pkgconfig"
4396 $pkgConfigPath = $pkgConfigPath.Replace('\', '/')
4497 echo "PKG_CONFIG_PATH=$pkgConfigPath" >> $env:GITHUB_ENV
45- if: ${{ startsWith( matrix.os , 'windows' ) }}
98+
99+ # ------------- pyodide ------------- #
100+
101+ - if : ${{ matrix.kind == 'pyodide' }}
102+ name : Set up Emscripten toolchain
103+ uses : pyodide/setup-emsdk@ca2dd8aef8c2a0e11743c5c36f0b430ddb694b5c # v15
104+ with :
105+ version : ${{ env.PYODIDE_EMSCRIPTEN_VERSION }}
106+ actions-cache-folder : emsdk-cache
107+
108+ - if : ${{ matrix.kind == 'pyodide' }}
109+ name : Check out Emscripten patches for Pyodide
110+ uses : actions/checkout@v6.0.2
111+ with :
112+ repository : pyodide/pyodide
113+ ref : ${{ env.PYODIDE_VERSION }}
114+ path : pyodide-patches
115+ sparse-checkout : |
116+ emsdk/patches/
117+
118+ # ------------- actual build ------------- #
46119
47120 - name : Build wheels
48121 uses : pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
49122 env :
123+ CIBW_PLATFORM : ${{ matrix.cibw_platform }}
124+ CIBW_BUILD : ${{ matrix.kind == 'pyodide' && env.PYODIDE_CIBW_BUILD || matrix.cibw_build }}
125+ CIBW_PYODIDE_VERSION : ${{ env.PYODIDE_VERSION }}
50126 # override setting in pyproject.toml to use msys2 instead of msys64 bash
51127 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' }}
52128
53129 - uses : actions/upload-artifact@v7
54130 with :
55- name : wheels- ${{ matrix.os }}
131+ name : ${{ matrix.artifact_name }}
56132 path : wheelhouse/*.whl
57133
58134 build_sdist :
64140
65141 - uses : actions/setup-python@v6
66142 with :
67- python-version : ' 3.13 '
143+ python-version : ${{ env.PYODIDE_PYTHON_VERSION }}
68144
69145 - run : bin/install_latest_flint_ubuntu.sh
70146 - run : pip install build
@@ -120,6 +196,35 @@ jobs:
120196
121197 - run : python -m flint.test --verbose
122198
199+ test_pyodide :
200+ needs : build_wheels
201+ name : Test Pyodide wheel
202+ runs-on : ubuntu-22.04
203+
204+ steps :
205+ - uses : actions/setup-python@v6
206+ with :
207+ python-version : ${{ env.PYODIDE_PYTHON_VERSION }}
208+
209+ - uses : actions/setup-node@v6
210+ with :
211+ node-version : ' 22'
212+
213+ - run : pip install pyodide-build
214+ - run : pyodide xbuildenv install "${{ env.PYODIDE_VERSION }}"
215+
216+ - uses : actions/download-artifact@v8
217+ with :
218+ name : wheels-pyodide
219+ path : wheelhouse
220+
221+ - run : |
222+ pyodide venv .venv-pyodide
223+ source .venv-pyodide/bin/activate
224+ pip install wheelhouse/*.whl
225+ pip install pytest hypothesis
226+ python -m pytest -svra -p no:cacheprovider --pyargs flint
227+
123228 # On new enough Ubuntu we can build against the system deb.
124229 test_pip_flint_deb :
125230 name : Build on ${{ matrix.os }}
@@ -338,7 +443,11 @@ jobs:
338443 merge-multiple : true
339444
340445 - name : Copy the PyPI files into dist
341- run : mkdir dist && cp wheelhouse/*.whl wheelhouse/*.tar.gz dist
446+ # pyodide wheels cannot be uploaded to PyPI
447+ run : |
448+ mkdir dist
449+ rm wheelhouse/*pyodide*.whl
450+ cp wheelhouse/*.whl wheelhouse/*.tar.gz dist
342451
343452 - name : Publish package on PyPI
344453 # It is recommended to pin a commit hash here for security but it
0 commit comments