Build a separate ARM wheel for macOS (#11149)

## Summary

Since we already build an x86 wheel, we can just build an ARM wheel
rather than cross-compiling to universal.

The build time is ~3 minutes vs. > 20 minutes and the resulting artifact
is much smaller, which is also a win for users.
This commit is contained in:
Charlie Marsh 2024-04-25 15:06:47 -04:00 committed by GitHub
parent 3364ef957d
commit dc09f529bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,8 +97,8 @@ jobs:
*.tar.gz *.tar.gz
*.sha256 *.sha256
macos-universal: macos-aarch64:
runs-on: macos-12 runs-on: macos-14
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -106,16 +106,17 @@ jobs:
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
architecture: x64 architecture: arm64
- name: "Prep README.md" - name: "Prep README.md"
run: python scripts/transform_readme.py --target pypi run: python scripts/transform_readme.py --target pypi
- name: "Build wheels - universal2" - name: "Build wheels - aarch64"
uses: PyO3/maturin-action@v1 uses: PyO3/maturin-action@v1
with: with:
args: --release --locked --target universal2-apple-darwin --out dist target: aarch64
- name: "Test wheel - universal2" args: --release --locked --out dist
- name: "Test wheel - aarch64"
run: | run: |
pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
ruff --help ruff --help
python -m ruff --help python -m ruff --help
- name: "Upload wheels" - name: "Upload wheels"
@ -451,7 +452,7 @@ jobs:
name: Upload to PyPI name: Upload to PyPI
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- macos-universal - macos-aarch64
- macos-x86_64 - macos-x86_64
- windows - windows
- linux - linux