From e6823ba55ca09a3c548482f946046ff2d39a7a34 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 20 Jan 2024 11:14:40 +1100 Subject: [PATCH] Point release to fix MacOS arm64 wheel builds (#81) --- .github/workflows/release-wheels.yml | 80 +++++++++++++++++++++------- pyproject.toml | 2 +- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index fda718d..a0f59d2 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -131,23 +131,6 @@ jobs: python: 312 platform_id: macosx_x86_64 - # MacOS arm64 - - os: macos-latest - python: 38 - platform_id: macosx_arm64 - - os: macos-latest - python: 39 - platform_id: macosx_arm64 - - os: macos-latest - python: 310 - platform_id: macosx_arm64 - - os: macos-latest - python: 311 - platform_id: macosx_arm64 - - os: macos-latest - python: 312 - platform_id: macosx_arm64 - steps: - uses: actions/checkout@v4 with: @@ -169,13 +152,14 @@ jobs: python -m pip install -U pip python -m pip install cibuildwheel>=2.16 - - name: Build wheels + - name: Build wheels (non-MacOS arm64) env: CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} CIBW_ARCHS: all CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }} CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_image }} + CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD_VERBOSITY: 1 run: | python --version @@ -187,9 +171,66 @@ jobs: name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} path: ./dist + build-wheels-macos-arm64: + name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + python: 38 + platform_id: macosx_arm64 + - os: macos-latest + python: 39 + platform_id: macosx_arm64 + - os: macos-latest + python: 310 + platform_id: macosx_arm64 + - os: macos-latest + python: 311 + platform_id: macosx_arm64 + - os: macos-latest + python: 312 + platform_id: macosx_arm64 + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: '3.9' + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.2 wheel==0.42 + + - name: Build wheels + env: + CIBW_BUILD: cp${{ matrix.python }}-* + CIBW_ARCHS_MACOS: arm64 + CIBW_BUILD_VERBOSITY: 1 + run: | + python -m cibuildwheel --output-dir dist + + # Cross compiling wheels for arm64 with poetry creates wheels with wrong tag + # Update the wheel with the correct tag then remove the incorrect wheel + - name: Fix poetry mistagging + run: | + wheel tags --platform-tag macosx_12_0_arm64 ./dist/*-macosx_12_0_x86_64.whl + rm ./dist/*-macosx_12_0_x86_64.whl + + - name: Store artifacts + uses: actions/upload-artifact@v4 + with: + name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} + path: ./dist/*.whl + test-package: name: Test built package - needs: [ build-wheels, build-sdist ] + needs: [ build-wheels, build-sdist, build-wheels-macos-arm64 ] runs-on: ubuntu-latest timeout-minutes: 30 strategy: @@ -233,7 +274,6 @@ jobs: python -m pytest --pyargs openjpeg.tests deactivate - # The pypi upload fails with non-linux containers, so grab the uploaded # artifacts and run using those # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15 diff --git a/pyproject.toml b/pyproject.toml index 9700362..0cba5c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ packages = [ {include = "openjpeg" }, ] readme = "README.md" -version = "2.1.0" +version = "2.1.1" [tool.poetry.dependencies] python = "^3.8"