1- # Borrowing from pycares/cyares
1+ # borrowing from pycares again due to the complexity of building wheels being rather annoying.
22
33on :
44 workflow_call :
1313 required : false
1414 default : false
1515 type : boolean
16- env :
17- # PyPy is currently unsupported.
18- CIBW_SKIP : pp*
19-
2016
2117jobs :
18+ generate-wheels-matrix :
19+ # Create a matrix of all architectures & versions to build.
20+ # This enables the next step to run cibuildwheel in parallel.
21+ # From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210
22+ name : Generate wheels matrix
23+ runs-on : ubuntu-latest
24+ outputs :
25+ include : ${{ steps.set-matrix.outputs.include }}
26+ steps :
27+ - uses : actions/checkout@v6
28+ - name : Install cibuildwheel
29+ # Nb. keep cibuildwheel version pin consistent with job below
30+ run : pipx install cibuildwheel==3.2.1
31+ - id : set-matrix
32+ # Trimmed out setupmatrix for just windows but I might look at compiling other oses just for fun
33+ # to let others test what it would be like if uvloop supported windows. It's very tempting...
34+ run : |
35+ MATRIX=$(
36+ {
37+ cibuildwheel --print-build-identifiers --platform windows --archs AMD64 \
38+ | jq -nRc '{"only": inputs, "os": "windows-latest"}' \
39+ && cibuildwheel --print-build-identifiers --platform windows --archs ARM64 \
40+ | jq -nRc '{"only": inputs, "os": "windows-11-arm"}'
41+ } | jq -sc
42+ )
43+ echo "include=$MATRIX" >> $GITHUB_OUTPUT
44+
2245 build_wheels :
23- name : Build wheels for ${{ matrix.name }}
46+ name : Build wheels for ${{ matrix.only }}
2447 runs-on : ${{ matrix.os }}
48+ needs : generate-wheels-matrix
2549 strategy :
2650 fail-fast : ${{ inputs.fail-fast }}
2751 matrix :
28- include :
29- # NOTE: This does compile on Linux but linux fails pytest
30- - name : Windows
31- os : windows-latest
32- - name : Windows arm64
33- os : windows-11-arm
52+ include : ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
3453 steps :
3554 - uses : actions/checkout@v6
3655 with :
3756 submodules : true
57+ - name : Set up QEMU
58+ if : runner.os == 'Linux'
59+ uses : docker/setup-qemu-action@v4
60+ with :
61+ platforms : all
3862 - name : Enable CPython prerelease
3963 if : ${{ inputs.prerelease-pythons }}
4064 run : echo "CIBW_ENABLE=cpython-prerelease" >> $GITHUB_ENV
4165 - name : Build wheels
4266 uses : pypa/cibuildwheel@v3.4.1
4367 with :
68+ only : ${{ matrix.only }}
4469 output-dir : dist
45-
4670 - uses : actions/upload-artifact@v7
4771 with :
48- name : wheels-${{ matrix.os }}
49- path : dist/*.whl
72+ name : wheels-${{ matrix.only }}
73+ path : dist/*.whl
0 commit comments