@@ -131,23 +131,6 @@ jobs:
131131 python : 312
132132 platform_id : macosx_x86_64
133133
134- # MacOS arm64
135- - os : macos-latest
136- python : 38
137- platform_id : macosx_arm64
138- - os : macos-latest
139- python : 39
140- platform_id : macosx_arm64
141- - os : macos-latest
142- python : 310
143- platform_id : macosx_arm64
144- - os : macos-latest
145- python : 311
146- platform_id : macosx_arm64
147- - os : macos-latest
148- python : 312
149- platform_id : macosx_arm64
150-
151134 steps :
152135 - uses : actions/checkout@v4
153136 with :
@@ -169,13 +152,14 @@ jobs:
169152 python -m pip install -U pip
170153 python -m pip install cibuildwheel>=2.16
171154
172- - name : Build wheels
155+ - name : Build wheels (non-MacOS arm64)
173156 env :
174157 CIBW_BUILD : cp${{ matrix.python }}-${{ matrix.platform_id }}
175158 CIBW_ARCHS : all
176159 CIBW_MANYLINUX_X86_64_IMAGE : ${{ matrix.manylinux_image }}
177160 CIBW_MANYLINUX_I686_IMAGE : ${{ matrix.manylinux_image }}
178161 CIBW_MANYLINUX_AARCH64_IMAGE : ${{ matrix.manylinux_image }}
162+ CIBW_ARCHS_MACOS : x86_64
179163 CIBW_BUILD_VERBOSITY : 1
180164 run : |
181165 python --version
@@ -187,9 +171,66 @@ jobs:
187171 name : wheel-${{ matrix.python }}-${{ matrix.platform_id }}
188172 path : ./dist
189173
174+ build-wheels-macos-arm64 :
175+ name : Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}
176+ runs-on : ${{ matrix.os }}
177+ strategy :
178+ fail-fast : false
179+ matrix :
180+ include :
181+ - os : macos-latest
182+ python : 38
183+ platform_id : macosx_arm64
184+ - os : macos-latest
185+ python : 39
186+ platform_id : macosx_arm64
187+ - os : macos-latest
188+ python : 310
189+ platform_id : macosx_arm64
190+ - os : macos-latest
191+ python : 311
192+ platform_id : macosx_arm64
193+ - os : macos-latest
194+ python : 312
195+ platform_id : macosx_arm64
196+
197+ steps :
198+ - uses : actions/checkout@v4
199+ with :
200+ submodules : true
201+
202+ - uses : actions/setup-python@v5
203+ name : Install Python
204+ with :
205+ python-version : ' 3.9'
206+
207+ - name : Install cibuildwheel
208+ run : python -m pip install cibuildwheel==2.16.2 wheel==0.42
209+
210+ - name : Build wheels
211+ env :
212+ CIBW_BUILD : cp${{ matrix.python }}-*
213+ CIBW_ARCHS_MACOS : arm64
214+ CIBW_BUILD_VERBOSITY : 1
215+ run : |
216+ python -m cibuildwheel --output-dir dist
217+
218+ # Cross compiling wheels for arm64 with poetry creates wheels with wrong tag
219+ # Update the wheel with the correct tag then remove the incorrect wheel
220+ - name : Fix poetry mistagging
221+ run : |
222+ wheel tags --platform-tag macosx_12_0_arm64 ./dist/*-macosx_12_0_x86_64.whl
223+ rm ./dist/*-macosx_12_0_x86_64.whl
224+
225+ - name : Store artifacts
226+ uses : actions/upload-artifact@v4
227+ with :
228+ name : wheel-${{ matrix.python }}-${{ matrix.platform_id }}
229+ path : ./dist/*.whl
230+
190231 test-package :
191232 name : Test built package
192- needs : [ build-wheels, build-sdist ]
233+ needs : [ build-wheels, build-sdist, build-wheels-macos-arm64 ]
193234 runs-on : ubuntu-latest
194235 timeout-minutes : 30
195236 strategy :
@@ -233,7 +274,6 @@ jobs:
233274 python -m pytest --pyargs openjpeg.tests
234275 deactivate
235276
236-
237277 # The pypi upload fails with non-linux containers, so grab the uploaded
238278 # artifacts and run using those
239279 # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15
0 commit comments