Created
March 31, 2023 11:27
-
-
Save anderssonjohan/49f07e33fc5cb2420515a8ac76dc0c95 to your computer and use it in GitHub Desktop.
Fix arm wheels created with x86_64 platform tag based on https://github.com/pypa/cibuildwheel/pull/1416
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, windows-2022, macos-12] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: cp311-* | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_wheels_macos_arm: | |
name: Build arm64 wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-12] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: cp311-* | |
CIBW_ARCHS_MACOS: arm64 | |
# cross compiling wheels for arm and poetry based projects | |
# creates wheels with the wrong platform tag. | |
# The wheel manifest + filename will get tagged with x86_64 instead of arm64 | |
# We can use the new wheel (0.40) tags command to fix this. | |
- run: pip install wheel==0.40 | |
# create pendulum-2.1.2-cp311-cp311-macosx_12_0_arm64.whl | |
- run: wheel tags --platform-tag macosx_12_0_arm64 ./wheelhouse/pendulum-2.1.2-cp311-cp311-macosx_12_0_x86_64.whl | |
# remove the incorrectly tagged arm64 wheel | |
- run: rm ./wheelhouse/pendulum-2.1.2-cp311-cp311-macosx_12_0_x86_64.whl | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
publish: | |
needs: [build_wheels, build_wheels_macos_arm] | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: wheelhouse | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: wheelhouse/*.whl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment