Skip to content

Commit

Permalink
- Add support for building arm64 wheels on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Nov 13, 2022
1 parent 057c3cb commit bf201dc
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 12 deletions.
68 changes: 57 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ jobs:
pip install -U pip
pip install -U setuptools wheel twine cffi
- name: Build AccessControl (Python 3.10 and 3.11 on MacOS)
- name: Build AccessControl (macOS x86_64, Python 3.8+)
if: >
startsWith(runner.os, 'Mac')
&& (startsWith(matrix.python-version, '3.10')
|| startsWith(matrix.python-version, '3.11'))
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '2.7'
|| matrix.python-version == '3.5'
|| matrix.python-version == '3.6'
|| matrix.python-version == '3.7')
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
_PYTHON_HOST_PLATFORM: macosx-10.9-x86_64
Expand All @@ -154,29 +157,72 @@ jobs:
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
# Also install it, so that we get dependencies in the (pip) cache.
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
pip install .[test]
- name: Build AccessControl (macOS arm64, Python 3.8+)
if: >
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '2.7'
|| matrix.python-version == '3.5'
|| matrix.python-version == '3.6'
|| matrix.python-version == '3.7')
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
ARCHFLAGS: -arch arm64
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Build AccessControl (all other versions)
if: >
!startsWith(runner.os, 'Mac')
|| !(startsWith(matrix.python-version, '3.10')
|| startsWith(matrix.python-version, '3.11'))
|| startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '2.7'
|| matrix.python-version == '3.5'
|| matrix.python-version == '3.6'
|| matrix.python-version == '3.7'
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
# Also install it, so that we get dependencies in the (pip) cache.
- name: Install AccessControl and dependencies
run: |
# Install to collect dependencies into the (pip) cache.
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
pip install .[test]
- name: Check AccessControl build
run: |
ls -l dist
twine check dist/*
- name: Upload AccessControl wheel
- name: Upload AccessControl wheel (macOS x86_64)
if: >
startsWith(runner.os, 'Mac')
uses: actions/upload-artifact@v3
with:
name: AccessControl-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/*x86_64.whl
- name: Upload AccessControl wheel (macOS arm64)
if: >
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '2.7'
|| matrix.python-version == '3.5'
|| matrix.python-version == '3.6'
|| matrix.python-version == '3.7')
uses: actions/upload-artifact@v3
with:
# The arm64 wheel is uploaded with a different name just so it can be
# manually downloaded when desired. The wheel itself *cannot* be tested
# on the GHA runner, which uses x86_64 architecture.
name: AccessControl-${{ runner.os }}-${{ matrix.python-version }}-arm64.whl
path: dist/*arm64.whl
- name: Upload AccessControl wheel (all other platforms)
if: >
!startsWith(runner.os, 'Mac')
uses: actions/upload-artifact@v3
with:
name: AccessControl-${{ runner.os }}-${{ matrix.python-version }}.whl
Expand Down
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "f9d86135b0fe60f778df1c75c869f61449eff05e"
commit-id = "57e4030390098babcc18db626cc426388394c231"

[python]
with-appveyor = true
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ For changes before version 3.0, see ``HISTORY.rst``.
5.7 (unreleased)
----------------

- Add support for building arm64 wheels on macOS.


5.6 (2022-11-03)
----------------
Expand Down

0 comments on commit bf201dc

Please sign in to comment.