Skip to content

Commit a267513

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR #19402: Build aarch64 wheels
1 parent 6498226 commit a267513

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,24 @@ jobs:
1212
build_wheels:
1313
name: Build wheels on ${{ matrix.os }}
1414
runs-on: ${{ matrix.os }}
15+
env:
16+
min-numpy-version: "1.16.0"
17+
min-numpy-hash: "04/b6/d7faa70a3e3eac39f943cc6a6a64ce378259677de516bd899dd9eb8f9b32"
1518
strategy:
1619
matrix:
1720
os: [ubuntu-18.04, windows-latest, macos-latest]
21+
cibw_archs: ["auto"]
22+
include:
23+
- os: ubuntu-18.04
24+
cibw_archs: "aarch64"
1825

1926
steps:
27+
- name: Set up QEMU
28+
if: matrix.cibw_archs == 'aarch64'
29+
uses: docker/setup-qemu-action@v1
30+
with:
31+
platforms: arm64
32+
2033
- uses: actions/checkout@v2
2134
with:
2235
fetch-depth: 0
@@ -26,9 +39,26 @@ jobs:
2639
with:
2740
python-version: '3.7'
2841

42+
- uses: actions/cache@v2
43+
id: numpy-cache
44+
with:
45+
path: numpy-aarch64-cache/
46+
key: numpy-${{ matrix.cibw_archs }}-cache-${{ env.min-numpy-version }}
47+
2948
- name: Install cibuildwheel
3049
run: |
31-
python -m pip install cibuildwheel==1.6.3
50+
python -m pip install cibuildwheel==1.9.0
51+
52+
- name: Build minimum NumPy for aarch64
53+
if: matrix.cibw_archs == 'aarch64' && steps.numpy-cache.outputs.cache-hit != 'true'
54+
run: |
55+
wget https://files.pythonhosted.org/packages/${{ env.min-numpy-hash }}/numpy-${{ env.min-numpy-version }}.zip
56+
unzip numpy-${{ env.min-numpy-version }}.zip
57+
cd numpy-${{ env.min-numpy-version }}
58+
python -m cibuildwheel --output-dir ../numpy-aarch64-cache
59+
env:
60+
CIBW_BUILD: "cp36-* cp37-* cp38-*"
61+
CIBW_ARCHS: aarch64
3262

3363
- name: Copy setup.cfg to configure wheel
3464
run: |
@@ -43,17 +73,18 @@ jobs:
4373
CIBW_MANYLINUX_I686_IMAGE: manylinux1
4474
CIBW_BEFORE_BUILD: pip install certifi numpy==1.19.3
4575
MPL_DISABLE_FH4: "yes"
76+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
4677

4778
- name: Build wheels for CPython
4879
run: |
4980
python -m cibuildwheel --output-dir dist
5081
env:
51-
CIBW_BUILD: "cp3?-*"
52-
CIBW_SKIP: "cp35-* cp36-* cp39-*"
82+
CIBW_BUILD: "cp37-* cp38-*"
5383
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
5484
CIBW_MANYLINUX_I686_IMAGE: manylinux1
55-
CIBW_BEFORE_BUILD: pip install certifi numpy==1.16
85+
CIBW_BEFORE_BUILD: pip install certifi; pip install --find-links=numpy-aarch64-cache/ numpy==${{ env.min-numpy-version }}
5686
MPL_DISABLE_FH4: "yes"
87+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
5788

5889
- name: Build wheels for CPython 3.6
5990
run: |
@@ -62,8 +93,9 @@ jobs:
6293
CIBW_BUILD: "cp36-*"
6394
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
6495
CIBW_MANYLINUX_I686_IMAGE: manylinux1
65-
CIBW_BEFORE_BUILD: pip install certifi numpy==1.16
96+
CIBW_BEFORE_BUILD: pip install certifi; pip install --find-links=numpy-aarch64-cache/ numpy==${{ env.min-numpy-version }}
6697
MPL_DISABLE_FH4: "yes"
98+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
6799
if: >
68100
startsWith(github.ref, 'refs/heads/v3.3') ||
69101
startsWith(github.ref, 'refs/tags/v3.3')
@@ -73,7 +105,8 @@ jobs:
73105
python -m cibuildwheel --output-dir dist
74106
env:
75107
CIBW_BUILD: "pp3?-*"
76-
CIBW_BEFORE_BUILD: pip install certifi numpy==1.16
108+
CIBW_BEFORE_BUILD: pip install certifi numpy==${{ env.min-numpy-version }}
109+
CIBW_ARCHS: ${{ matrix.cibw_archs }}
77110
if: >
78111
runner.os != 'Windows' && (
79112
startsWith(github.ref, 'refs/heads/v3.3') ||

0 commit comments

Comments
 (0)