From d8ae726fdd33c2ef5e0792b656b2751e4360ea41 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 20 Aug 2024 19:50:17 +0100 Subject: [PATCH 1/7] Build aarch64 wheels --- .github/workflows/wheel.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 6746ffb8..b9f293c2 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -8,17 +8,22 @@ concurrency: jobs: build_wheels: - name: Build wheel on ${{ matrix.os }} + name: Build ${{ matrix.archs }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is a arm64 runner os: [ubuntu-latest, windows-latest, macos-13, macos-14] + archs: ["native"] + include: + - os: ubuntu-latest + archs: "aarch64" env: CIBW_TEST_COMMAND: python -c "import numcodecs" CIBW_BUILD: "cp311-* cp312-* cp313-*" CIBW_SKIP: "pp* *-musllinux_* *win32 *_i686 *_s390x" + CIBW_ARCHS: ${{ matrix.archs }} # note: CIBW_ENVIRONMENT is now set in pyproject.toml steps: From b28aa1c47cd6a577c32352037749795a9830dca2 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 20 Aug 2024 20:51:57 +0100 Subject: [PATCH 2/7] Add QEMU setup --- .github/workflows/wheel.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index b9f293c2..139a2715 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -33,6 +33,10 @@ jobs: - uses: pypa/cibuildwheel@v2.22.0 + - name: Set up QEMU + if: ${{ matrix.archs == 'aarch64' }} + uses: docker/setup-qemu-action@v3 + - uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.os }} From 46a39c8adf1b5eb3d20c8a35fe0ab8578628d700 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 21 Aug 2024 08:32:34 +0100 Subject: [PATCH 3/7] Skip sse and avx flags on aarch64 --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0f5ec481..8d844de7 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,9 @@ if have_cflags: # respect compiler options set by user pass -elif os.name == 'posix': +elif os.name == 'posix' and os.uname()[4] != 'aarch64': + # These flags aren't recognised by gcc on aarch64 + # (at least when we build the aarch64 wheens on GitHub actions) if disable_sse2: base_compile_args.append('-mno-sse2') elif have_sse2: From eb280d6f4e791ee48125e0aed6060bd74ec95f6b Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 23 Aug 2024 15:49:50 +0100 Subject: [PATCH 4/7] Explicitly specify architectures --- .github/workflows/wheel.yaml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 139a2715..f51a3ad6 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -8,22 +8,21 @@ concurrency: jobs: build_wheels: - name: Build ${{ matrix.archs }} wheel on ${{ matrix.os }} + name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is a arm64 runner os: [ubuntu-latest, windows-latest, macos-13, macos-14] - archs: ["native"] - include: - - os: ubuntu-latest - archs: "aarch64" + build_all: + - ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')) || contains(github.event.pull_request.labels.*.name, 'test all wheels')}} env: CIBW_TEST_COMMAND: python -c "import numcodecs" CIBW_BUILD: "cp311-* cp312-* cp313-*" - CIBW_SKIP: "pp* *-musllinux_* *win32 *_i686 *_s390x" - CIBW_ARCHS: ${{ matrix.archs }} + CIBW_ARCHS_MACOS: native + CIBW_ARCHS_WINDOWS: native + CIBW_ARCHS_LINUX: "x86_64 aarch64" # note: CIBW_ENVIRONMENT is now set in pyproject.toml steps: @@ -31,12 +30,17 @@ jobs: with: submodules: true - - uses: pypa/cibuildwheel@v2.22.0 + - name: Restrict number of wheel builds on PRs + if: ${{ !matrix.build_all }} + run: | + echo "CIBW_BUILD=cp310-win_amd64 cp311-manylinux_x86_64 cp312-macosx_x86_64 cp312-macosx_arm64" >> $GITHUB_ENV - name: Set up QEMU - if: ${{ matrix.archs == 'aarch64' }} + if: ${{ matrix.os == 'ubuntu-latest' }} uses: docker/setup-qemu-action@v3 + - uses: pypa/cibuildwheel@v2.22.0 + - uses: actions/upload-artifact@v4 with: name: wheels-${{ matrix.os }} From 573cff75461565a8b8d2eee3e93f4affd3c08a3a Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 23 Aug 2024 16:09:31 +0100 Subject: [PATCH 5/7] Fix build_all conditional --- .github/workflows/wheel.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index f51a3ad6..7711b6cb 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -15,8 +15,16 @@ jobs: matrix: # macos-13 is an intel runner, macos-14 is a arm64 runner os: [ubuntu-latest, windows-latest, macos-13, macos-14] - build_all: - - ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')) || contains(github.event.pull_request.labels.*.name, 'test all wheels')}} + # Build all wheels on either: + # - tagged release + # - pull request opened with "test all wheels" label + # - pull requests when "test all wheels" label is added + build_all: | + ${{ + (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')) + || contains(github.event.pull_request.labels.*.name, 'test all wheels') + || (github.event.action == 'labeled' && github.event.label.name == 'test all wheels') + }} env: CIBW_TEST_COMMAND: python -c "import numcodecs" CIBW_BUILD: "cp311-* cp312-* cp313-*" From 6bd9cf63e00eba39493cb7ac0ec567f053388170 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 23 Aug 2024 16:25:24 +0100 Subject: [PATCH 6/7] Use environment variable for build_all --- .github/workflows/wheel.yaml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 7711b6cb..bb3b5258 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -6,6 +6,18 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +env: + # Build all wheels on either: + # - tagged release + # - pull request opened with "test all wheels" label + # - pull requests when "test all wheels" label is added + BUILD_ALL: | + ${{ + (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')) + || contains(github.event.pull_request.labels.*.name, 'test all wheels') + || (github.event.action == 'labeled' && github.event.label.name == 'test all wheels') + }} + jobs: build_wheels: name: Build wheels on ${{ matrix.os }} @@ -15,16 +27,6 @@ jobs: matrix: # macos-13 is an intel runner, macos-14 is a arm64 runner os: [ubuntu-latest, windows-latest, macos-13, macos-14] - # Build all wheels on either: - # - tagged release - # - pull request opened with "test all wheels" label - # - pull requests when "test all wheels" label is added - build_all: | - ${{ - (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')) - || contains(github.event.pull_request.labels.*.name, 'test all wheels') - || (github.event.action == 'labeled' && github.event.label.name == 'test all wheels') - }} env: CIBW_TEST_COMMAND: python -c "import numcodecs" CIBW_BUILD: "cp311-* cp312-* cp313-*" @@ -39,7 +41,7 @@ jobs: submodules: true - name: Restrict number of wheel builds on PRs - if: ${{ !matrix.build_all }} + if: ${{ !env.BUILD_ALL }} run: | echo "CIBW_BUILD=cp310-win_amd64 cp311-manylinux_x86_64 cp312-macosx_x86_64 cp312-macosx_arm64" >> $GITHUB_ENV From e590abd44813fabb9416bb5cfb41c920417ad047 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 23 Aug 2024 19:38:48 +0100 Subject: [PATCH 7/7] Add changelog entry --- docs/release.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 68a751d3..a070530c 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -43,7 +43,8 @@ Improvements Import errors caused by optional dependencies (ZFPY, MsgPack, CRC32C, and PCodec) are still silently caught. By :user:`David Stansby `, :issue:`550`. - +* Build aarch64 wheels on linux. + By :user:`David Stansby `, :issue:`531` 0.14.1 ------ @@ -116,6 +117,10 @@ Enhancements * Cleaned up the table of contents in the documentation to list codecs by category :user:`David Stansby `, :issue:`458`. +Fix +~~~ + + Maintenance ~~~~~~~~~~~ * Change format() and old string formatting to f-strings. @@ -123,6 +128,13 @@ Maintenance * Remove pin on Sphinx By :user:`Elliott Sales de Andrade `, :issue:`552`. +* Restrict the number of wheels built on pull requests. + By :user:`David Stansby `, :issue:`531` + +* Add an option to build all wheels on pull requests by adding + the 'build all wheels' label. + By :user:`David Stansby `, :issue:`531` + .. _release_0.13.0: