From 36b1a69a716c0f628c460f3690d7e93aaaf85bec Mon Sep 17 00:00:00 2001 From: odidev Date: Wed, 6 Oct 2021 07:50:02 +0530 Subject: [PATCH 1/4] Add linux aarch64 wheel build support Signed-off-by: odidev --- .github/workflows/wheel.yaml | 19 ++++++++++++++++++- setup.py | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 4ef4672f..ffa46832 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -4,13 +4,18 @@ on: [push, pull_request] jobs: build_wheels: - name: Build wheel on ${{ matrix.os }} + name: Build wheel on ${{matrix.arch}} for ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] + arch: [auto] + include: + - os: ubuntu-latest + arch: aarch64 env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} CIBW_TEST_COMMAND: pytest --pyargs numcodecs CIBW_TEST_REQUIRES: pytest CIBW_SKIP: "*27* pp* *35*" @@ -27,11 +32,23 @@ jobs: with: python-version: '3.9' + - uses: docker/setup-qemu-action@v1 + if: ${{ matrix.arch == 'aarch64' }} + name: Set up QEMU + - name: Install cibuildwheel run: | python -m pip install cibuildwheel==1.8.0 wheel + - name: Build wheel for aarch64 + if: ${{ matrix.arch == 'aarch64' }} + env: + CIBW_ENVIRONMENT: 'DISABLE_NUMCODECS_AVX2=1 DISABLE_NUMCODECS_SSE2=1' + run: | + python -m cibuildwheel --output-dir wheelhouse + - name: Build wheel + if: ${{ matrix.arch != 'aarch64' }} run: | python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v1 diff --git a/setup.py b/setup.py index c8622fd6..eea475a3 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import os from setuptools import setup, Extension import cpuinfo +import platform import sys from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ @@ -28,6 +29,8 @@ if have_cflags: # respect compiler options set by user pass +elif platform.machine() == 'aarch64': + pass elif os.name == 'posix': if disable_sse2: base_compile_args.append('-mno-sse2') From e4bd997a96243500089cbbc4502da05b92a19cfe Mon Sep 17 00:00:00 2001 From: jthetzel Date: Sun, 9 Jul 2023 17:07:34 -0230 Subject: [PATCH 2/4] ci: Add separate aarch64 wheel build on deployment --- .github/workflows/wheel-aarch64.yaml | 52 ++++++++++++++++++++++++++++ setup.py | 3 ++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/wheel-aarch64.yaml diff --git a/.github/workflows/wheel-aarch64.yaml b/.github/workflows/wheel-aarch64.yaml new file mode 100644 index 00000000..03566d58 --- /dev/null +++ b/.github/workflows/wheel-aarch64.yaml @@ -0,0 +1,52 @@ +name: Wheels AArch64 + +on: + push: + tags: + - "v*" + +jobs: + build_wheels: + name: Build wheel on ${{matrix.arch}} for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + arch: [aarch64] + env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} + CIBW_TEST_COMMAND: pytest --pyargs numcodecs + CIBW_TEST_REQUIRES: pytest + CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp311-* *-musllinux_* *win32 *_i686 *_s390x" + CIBW_ENVIRONMENT: "DISABLE_NUMCODECS_AVX2=1 DISABLE_NUMCODECS_SSE2=1" + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - uses: docker/setup-qemu-action@v1 + name: Set up QEMU + + - uses: pypa/cibuildwheel@v2.12.0 + + - uses: actions/upload-artifact@v3 + with: + name: wheels + path: ./wheelhouse + + upload_pypi: + needs: [build_wheels] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: dist + + - uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} + # To test: repository_url: https://test.pypi.org/legacy/ diff --git a/setup.py b/setup.py index 14072445..4255eaeb 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from glob import glob import cpuinfo +import platform from Cython.Distutils.build_ext import new_build_ext as build_ext from setuptools import Extension, setup from setuptools.errors import CCompilerError, ExecError, PlatformError @@ -21,6 +22,8 @@ if have_cflags: # respect compiler options set by user pass +elif platform.machine() == 'aarch64': + pass elif os.name == 'posix': if disable_sse2: base_compile_args.append('-mno-sse2') From 6afe5252029aa08847f4961a24a5d1685c449ea9 Mon Sep 17 00:00:00 2001 From: jthetzel Date: Sun, 9 Jul 2023 17:21:13 -0230 Subject: [PATCH 3/4] fix: Enable Python >- 3.8 aarch64 wheels --- .github/workflows/wheel-aarch64.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheel-aarch64.yaml b/.github/workflows/wheel-aarch64.yaml index 03566d58..22edf057 100644 --- a/.github/workflows/wheel-aarch64.yaml +++ b/.github/workflows/wheel-aarch64.yaml @@ -18,7 +18,7 @@ jobs: CIBW_ARCHS_LINUX: ${{matrix.arch}} CIBW_TEST_COMMAND: pytest --pyargs numcodecs CIBW_TEST_REQUIRES: pytest - CIBW_SKIP: "pp* cp36-* cp37-* cp38-* cp39-* cp311-* *-musllinux_* *win32 *_i686 *_s390x" + CIBW_SKIP: "pp* cp36-* *-musllinux_* *win32 *_i686 *_s390x" CIBW_ENVIRONMENT: "DISABLE_NUMCODECS_AVX2=1 DISABLE_NUMCODECS_SSE2=1" steps: From fb49b78cae1e0d3991965148b170262ba7371024 Mon Sep 17 00:00:00 2001 From: jthetzel Date: Mon, 10 Jul 2023 06:44:42 -0230 Subject: [PATCH 4/4] docs: Add weel build to release.rst --- docs/release.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release.rst b/docs/release.rst index 3f2394b5..c612476b 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -29,6 +29,9 @@ Maintenance * Cleanup ``import``s in ``adhoc/blosc_memleak_check.py`` By :user:`John Kirkham `, :issue:`408`. +* Build wheels for Linux AArch64 on verison release. + By :user:`Jeremy Hetzel `, :issue:`315`. + .. _release_0.11.0: 0.11.0