Skip to content

Commit eb1af6e

Browse files
committed
- Add support for building arm64 wheels on macOS.
1 parent 50773ad commit eb1af6e

File tree

4 files changed

+84
-40
lines changed

4 files changed

+84
-40
lines changed

.github/workflows/tests.yml

Lines changed: 81 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ jobs:
117117

118118
steps:
119119
- name: checkout
120-
uses: actions/checkout@v2
120+
uses: actions/checkout@v3
121121
- name: Set up Python ${{ matrix.python-version }}
122-
uses: actions/setup-python@v2
122+
uses: actions/setup-python@v4
123123
with:
124124
python-version: ${{ matrix.python-version }}
125125
###
@@ -134,7 +134,7 @@ jobs:
134134
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
135135
136136
- name: pip cache
137-
uses: actions/cache@v2
137+
uses: actions/cache@v3
138138
with:
139139
path: ${{ steps.pip-cache.outputs.dir }}
140140
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
@@ -154,40 +154,90 @@ jobs:
154154
pip install -U pip
155155
pip install -U setuptools wheel twine cffi
156156
157-
- name: Build zope.interface (Python 3.10 on MacOS)
157+
- name: Build zope.interface (macOS x86_64, Python 3.8+)
158158
if: >
159159
startsWith(runner.os, 'Mac')
160-
&& startsWith(matrix.python-version, '3.10')
160+
&& !(startsWith(matrix.python-version, 'pypy')
161+
|| matrix.python-version == '2.7'
162+
|| matrix.python-version == '3.5'
163+
|| matrix.python-version == '3.6'
164+
|| matrix.python-version == '3.7')
161165
env:
162-
_PYTHON_HOST_PLATFORM: macosx-11-x86_64
166+
MACOSX_DEPLOYMENT_TARGET: 10.9
167+
_PYTHON_HOST_PLATFORM: macosx-10.9-x86_64
168+
ARCHFLAGS: -arch x86_64
169+
run: |
170+
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
171+
# output (pip install uses a random temporary directory, making this difficult).
172+
python setup.py build_ext -i
173+
python setup.py bdist_wheel
174+
- name: Build zope.interface (macOS arm64, Python 3.8+)
175+
if: >
176+
startsWith(runner.os, 'Mac')
177+
&& !(startsWith(matrix.python-version, 'pypy')
178+
|| matrix.python-version == '2.7'
179+
|| matrix.python-version == '3.5'
180+
|| matrix.python-version == '3.6'
181+
|| matrix.python-version == '3.7')
182+
env:
183+
MACOSX_DEPLOYMENT_TARGET: 11.0
184+
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
185+
ARCHFLAGS: -arch arm64
163186
run: |
164187
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
165188
# output (pip install uses a random temporary directory, making this difficult).
166189
python setup.py build_ext -i
167190
python setup.py bdist_wheel
168-
# Also install it, so that we get dependencies in the (pip) cache.
169-
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
170-
pip install .[test]
171-
172191
- name: Build zope.interface (all other versions)
173192
if: >
174193
!startsWith(runner.os, 'Mac')
175-
|| !startsWith(matrix.python-version, '3.10')
194+
|| startsWith(matrix.python-version, 'pypy')
195+
|| matrix.python-version == '2.7'
196+
|| matrix.python-version == '3.5'
197+
|| matrix.python-version == '3.6'
198+
|| matrix.python-version == '3.7'
176199
run: |
177200
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
178201
# output (pip install uses a random temporary directory, making this difficult).
179202
python setup.py build_ext -i
180203
python setup.py bdist_wheel
181-
# Also install it, so that we get dependencies in the (pip) cache.
204+
205+
- name: Install zope.interface and dependencies
206+
run: |
207+
# Install to collect dependencies into the (pip) cache.
182208
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
183209
pip install .[test]
184210
185211
- name: Check zope.interface build
186212
run: |
187213
ls -l dist
188214
twine check dist/*
189-
- name: Upload zope.interface wheel
190-
uses: actions/upload-artifact@v2
215+
- name: Upload zope.interface wheel (macOS x86_64)
216+
if: >
217+
startsWith(runner.os, 'Mac')
218+
uses: actions/upload-artifact@v3
219+
with:
220+
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}.whl
221+
path: dist/*x86_64.whl
222+
- name: Upload zope.interface wheel (macOS arm64)
223+
if: >
224+
startsWith(runner.os, 'Mac')
225+
&& !(startsWith(matrix.python-version, 'pypy')
226+
|| matrix.python-version == '2.7'
227+
|| matrix.python-version == '3.5'
228+
|| matrix.python-version == '3.6'
229+
|| matrix.python-version == '3.7')
230+
uses: actions/upload-artifact@v3
231+
with:
232+
# The arm64 wheel is uploaded with a different name just so it can be
233+
# manually downloaded when desired. The wheel itself *cannot* be tested
234+
# on the GHA runner, which uses x86_64 architecture.
235+
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}-arm64.whl
236+
path: dist/*arm64.whl
237+
- name: Upload zope.interface wheel (all other platforms)
238+
if: >
239+
!startsWith(runner.os, 'Mac')
240+
uses: actions/upload-artifact@v3
191241
with:
192242
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}.whl
193243
path: dist/*whl
@@ -233,9 +283,9 @@ jobs:
233283

234284
steps:
235285
- name: checkout
236-
uses: actions/checkout@v2
286+
uses: actions/checkout@v3
237287
- name: Set up Python ${{ matrix.python-version }}
238-
uses: actions/setup-python@v2
288+
uses: actions/setup-python@v4
239289
with:
240290
python-version: ${{ matrix.python-version }}
241291
###
@@ -250,15 +300,15 @@ jobs:
250300
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
251301
252302
- name: pip cache
253-
uses: actions/cache@v2
303+
uses: actions/cache@v3
254304
with:
255305
path: ${{ steps.pip-cache.outputs.dir }}
256306
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
257307
restore-keys: |
258308
${{ runner.os }}-pip-
259309
260310
- name: Download zope.interface wheel
261-
uses: actions/download-artifact@v2
311+
uses: actions/download-artifact@v3
262312
with:
263313
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}.whl
264314
path: dist/
@@ -310,9 +360,9 @@ jobs:
310360

311361
steps:
312362
- name: checkout
313-
uses: actions/checkout@v2
363+
uses: actions/checkout@v3
314364
- name: Set up Python ${{ matrix.python-version }}
315-
uses: actions/setup-python@v2
365+
uses: actions/setup-python@v4
316366
with:
317367
python-version: ${{ matrix.python-version }}
318368
###
@@ -327,15 +377,15 @@ jobs:
327377
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
328378
329379
- name: pip cache
330-
uses: actions/cache@v2
380+
uses: actions/cache@v3
331381
with:
332382
path: ${{ steps.pip-cache.outputs.dir }}
333383
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
334384
restore-keys: |
335385
${{ runner.os }}-pip-
336386
337387
- name: Download zope.interface wheel
338-
uses: actions/download-artifact@v2
388+
uses: actions/download-artifact@v3
339389
with:
340390
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}.whl
341391
path: dist/
@@ -361,9 +411,9 @@ jobs:
361411

362412
steps:
363413
- name: checkout
364-
uses: actions/checkout@v2
414+
uses: actions/checkout@v3
365415
- name: Set up Python ${{ matrix.python-version }}
366-
uses: actions/setup-python@v2
416+
uses: actions/setup-python@v4
367417
with:
368418
python-version: ${{ matrix.python-version }}
369419
###
@@ -378,15 +428,15 @@ jobs:
378428
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
379429
380430
- name: pip cache
381-
uses: actions/cache@v2
431+
uses: actions/cache@v3
382432
with:
383433
path: ${{ steps.pip-cache.outputs.dir }}
384434
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
385435
restore-keys: |
386436
${{ runner.os }}-pip-
387437
388438
- name: Download zope.interface wheel
389-
uses: actions/download-artifact@v2
439+
uses: actions/download-artifact@v3
390440
with:
391441
name: zope.interface-${{ runner.os }}-${{ matrix.python-version }}.whl
392442
path: dist/
@@ -414,9 +464,9 @@ jobs:
414464

415465
steps:
416466
- name: checkout
417-
uses: actions/checkout@v2
467+
uses: actions/checkout@v3
418468
- name: Set up Python ${{ matrix.python-version }}
419-
uses: actions/setup-python@v2
469+
uses: actions/setup-python@v4
420470
with:
421471
python-version: ${{ matrix.python-version }}
422472
###
@@ -431,7 +481,7 @@ jobs:
431481
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
432482
433483
- name: pip cache
434-
uses: actions/cache@v2
484+
uses: actions/cache@v3
435485
with:
436486
path: ${{ steps.pip-cache.outputs.dir }}
437487
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}
@@ -468,14 +518,14 @@ jobs:
468518
bash .manylinux.sh
469519
470520
- name: Upload zope.interface wheels
471-
uses: actions/upload-artifact@v2
521+
uses: actions/upload-artifact@v3
472522
with:
473523
path: wheelhouse/*whl
474524
name: manylinux_${{ matrix.image }}_wheels.zip
475525
- name: Restore pip cache permissions
476526
run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }}
477527
- name: Publish package to PyPI
478-
uses: pypa/gh-action-pypi-publish@v1.4.1
528+
uses: pypa/gh-action-pypi-publish@release/v1
479529
if: >
480530
github.event_name == 'push'
481531
&& startsWith(github.ref, 'refs/tags')

.meta.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/c-code
33
[meta]
44
template = "c-code"
5-
commit-id = "b4dd6f9ffd3d6a2cde7dc70512c62d4c7ed22cd6"
5+
commit-id = "57e4030390098babcc18db626cc426388394c231"
66

77
[python]
88
with-appveyor = true

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
5.5.2 (unreleased)
66
==================
77

8+
- Add support for building arm64 wheels on macOS.
9+
810

911
5.5.1 (2022-11-03)
1012
==================

appveyor.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,13 @@ environment:
1010
secure: aoZC/+rvJKg8B5GMGIxd1X2q2bz7SMl8G3810BID9U8PXFqM0FbWaK9fZ9qcU0UyG2xJsK56Fb6+L6g27I0Lg8UFNhlU1zLAuMSgJQbHsqawFgSY067IdJB68pp34d/oEyxMrJvAKENHH77Fe4KGDssLlk5WnnYS3DA9b66p5imP+1DTtkq5/gMtoG4nZTBtVos7J2kkYTQ5t4BjzTQxPMC3bStNnvuuB0orX4AoCyTrOR1wdZFiNKLzbVnrJCNn24t/n3kG9WrxbnKlrbOm4A==
1111

1212
matrix:
13-
- python: 27
1413
- python: 27-x64
15-
- python: 35
1614
- python: 35-x64
17-
- python: 36
1815
- python: 36-x64
19-
- python: 37
2016
- python: 37-x64
21-
- python: 38
2217
- python: 38-x64
23-
- python: 39
2418
- python: 39-x64
25-
- python: 310
2619
- python: 310-x64
27-
- python: 311
2820
- python: 311-x64
2921

3022
install:

0 commit comments

Comments
 (0)