From a26751327d3212690b46d0cc1e2c7dd7e2a86df9 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 9 Mar 2021 20:27:12 -0500 Subject: [PATCH] Backport PR #19402: Build aarch64 wheels --- .github/workflows/cibuildwheel.yml | 45 ++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index ac542bf2ab77..2100d15fe000 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -12,11 +12,24 @@ jobs: build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + env: + min-numpy-version: "1.16.0" + min-numpy-hash: "04/b6/d7faa70a3e3eac39f943cc6a6a64ce378259677de516bd899dd9eb8f9b32" strategy: matrix: os: [ubuntu-18.04, windows-latest, macos-latest] + cibw_archs: ["auto"] + include: + - os: ubuntu-18.04 + cibw_archs: "aarch64" steps: + - name: Set up QEMU + if: matrix.cibw_archs == 'aarch64' + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + - uses: actions/checkout@v2 with: fetch-depth: 0 @@ -26,9 +39,26 @@ jobs: with: python-version: '3.7' + - uses: actions/cache@v2 + id: numpy-cache + with: + path: numpy-aarch64-cache/ + key: numpy-${{ matrix.cibw_archs }}-cache-${{ env.min-numpy-version }} + - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==1.6.3 + python -m pip install cibuildwheel==1.9.0 + + - name: Build minimum NumPy for aarch64 + if: matrix.cibw_archs == 'aarch64' && steps.numpy-cache.outputs.cache-hit != 'true' + run: | + wget https://files.pythonhosted.org/packages/${{ env.min-numpy-hash }}/numpy-${{ env.min-numpy-version }}.zip + unzip numpy-${{ env.min-numpy-version }}.zip + cd numpy-${{ env.min-numpy-version }} + python -m cibuildwheel --output-dir ../numpy-aarch64-cache + env: + CIBW_BUILD: "cp36-* cp37-* cp38-*" + CIBW_ARCHS: aarch64 - name: Copy setup.cfg to configure wheel run: | @@ -43,17 +73,18 @@ jobs: CIBW_MANYLINUX_I686_IMAGE: manylinux1 CIBW_BEFORE_BUILD: pip install certifi numpy==1.19.3 MPL_DISABLE_FH4: "yes" + CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython run: | python -m cibuildwheel --output-dir dist env: - CIBW_BUILD: "cp3?-*" - CIBW_SKIP: "cp35-* cp36-* cp39-*" + CIBW_BUILD: "cp37-* cp38-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 - CIBW_BEFORE_BUILD: pip install certifi numpy==1.16 + CIBW_BEFORE_BUILD: pip install certifi; pip install --find-links=numpy-aarch64-cache/ numpy==${{ env.min-numpy-version }} MPL_DISABLE_FH4: "yes" + CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.6 run: | @@ -62,8 +93,9 @@ jobs: CIBW_BUILD: "cp36-*" CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 - CIBW_BEFORE_BUILD: pip install certifi numpy==1.16 + CIBW_BEFORE_BUILD: pip install certifi; pip install --find-links=numpy-aarch64-cache/ numpy==${{ env.min-numpy-version }} MPL_DISABLE_FH4: "yes" + CIBW_ARCHS: ${{ matrix.cibw_archs }} if: > startsWith(github.ref, 'refs/heads/v3.3') || startsWith(github.ref, 'refs/tags/v3.3') @@ -73,7 +105,8 @@ jobs: python -m cibuildwheel --output-dir dist env: CIBW_BUILD: "pp3?-*" - CIBW_BEFORE_BUILD: pip install certifi numpy==1.16 + CIBW_BEFORE_BUILD: pip install certifi numpy==${{ env.min-numpy-version }} + CIBW_ARCHS: ${{ matrix.cibw_archs }} if: > runner.os != 'Windows' && ( startsWith(github.ref, 'refs/heads/v3.3') ||