Skip to content

Commit df37b47

Browse files
committed
Build QEMU-emulated Linux aarch64 wheels on GitHub Actions
1 parent 85c5529 commit df37b47

1 file changed

Lines changed: 75 additions & 2 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,80 @@ env:
3030
FORCE_COLOR: 1
3131

3232
jobs:
33-
build:
33+
build-1-QEMU-emulated-wheels:
34+
name: QEMU ${{ matrix.python-version }} ${{ matrix.spec }}
35+
runs-on: ubuntu-latest
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
python-version:
40+
- pp39
41+
- pp310
42+
- cp38
43+
- cp39
44+
- cp310
45+
- cp311
46+
- cp312
47+
spec:
48+
- manylinux2014
49+
- manylinux_2_28
50+
- musllinux
51+
exclude:
52+
- { python-version: pp39, spec: musllinux }
53+
- { python-version: pp310, spec: musllinux }
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
submodules: true
59+
60+
- uses: actions/setup-python@v5
61+
with:
62+
python-version: "3.x"
63+
64+
# https://github.com/docker/setup-qemu-action
65+
- name: Set up QEMU
66+
uses: docker/setup-qemu-action@v3
67+
68+
# https://github.com/docker/setup-buildx-action
69+
- name: Set up Docker Buildx
70+
uses: docker/setup-buildx-action@v3
71+
72+
- name: Install cibuildwheel
73+
run: |
74+
python3 -m pip install -r .ci/requirements-cibw.txt
75+
76+
- name: Build wheels (manylinux)
77+
if: matrix.spec != 'musllinux'
78+
run: |
79+
python3 -m cibuildwheel --output-dir wheelhouse
80+
env:
81+
# Build only the currently selected Linux architecture (so we can
82+
# parallelise for speed).
83+
CIBW_ARCHS_LINUX: "aarch64"
84+
# Likewise, select only one Python version per job to speed this up.
85+
CIBW_BUILD: "${{ matrix.python-version }}-manylinux*"
86+
# Extra options for manylinux.
87+
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.spec }}
88+
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: ${{ matrix.spec }}
89+
90+
- name: Build wheels (musllinux)
91+
if: matrix.spec == 'musllinux'
92+
run: |
93+
python3 -m cibuildwheel --output-dir wheelhouse
94+
env:
95+
# Build only the currently selected Linux architecture (so we can
96+
# parallelise for speed).
97+
CIBW_ARCHS_LINUX: "aarch64"
98+
# Likewise, select only one Python version per job to speed this up.
99+
CIBW_BUILD: "${{ matrix.python-version }}-${{ matrix.spec }}*"
100+
101+
- uses: actions/upload-artifact@v4
102+
with:
103+
name: dist-qemu-${{ matrix.python-version }}-${{ matrix.spec }}
104+
path: ./wheelhouse/*.whl
105+
106+
build-2-native-wheels:
34107
name: ${{ matrix.name }}
35108
runs-on: ${{ matrix.os }}
36109
strategy:
@@ -187,7 +260,7 @@ jobs:
187260

188261
pypi-publish:
189262
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
190-
needs: [build, windows, sdist]
263+
needs: [build-1-QEMU-emulated-wheels, build-2-native-wheels, windows, sdist]
191264
runs-on: ubuntu-latest
192265
name: Upload release to PyPI
193266
environment:

0 commit comments

Comments
 (0)