Skip to content

Commit 416df50

Browse files
committed
CI:CD: Apple Silicon wheels on Cirrus CI
1 parent 7364bdc commit 416df50

File tree

9 files changed

+142
-84
lines changed

9 files changed

+142
-84
lines changed

.cirrus.star

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ def main(ctx):
1919
if "[skip cirrus]" in dct["message"] or "[skip ci]" in dct["message"]:
2020
return []
2121

22+
# this configuration starts building wheels for release.
23+
if "[publish]" in dct["message"]:
24+
return fs.read("ci/cirrus_wheels.yml")
25+
2226
# this configuration(default) runs macosx_arm64 builds from source.
2327
return fs.read("ci/cirrus_general_ci.yml")

.github/wheels_m1.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/publish-pypi-from-gh.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/publish-pypi-pi_heif.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1-
name: Build & Publish(Pi-Heif)
1+
name: Publish • Pi-Heif
22
# This action build `pi-heif` which is `pillow-heif` but without `aom` and `x265` libraries.
3-
#Note: Wheels for the Apple M1 are assembled locally and manually uploaded.
43

54
on:
6-
workflow_dispatch:
5+
workflow_run:
6+
workflows: [Publish • Pillow-Heif]
7+
types:
8+
- completed
79

810
jobs:
11+
wheels_macos_arm:
12+
name: macosx • aarch64
13+
runs-on: ubuntu-20.04
14+
15+
steps:
16+
- name: Waiting for Cirrus CI
17+
uses: lewagon/[email protected]
18+
with:
19+
ref: ${{ github.ref }}
20+
check-name: 'macosx • aarch64 • Pi-Heif • Cirrus'
21+
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
wait-interval: 10
23+
24+
- name: Download artifacts
25+
run: |
26+
curl -L https://api.cirrus-ci.com/v1/artifact/github/${{ github.repository }}/wheel_pi_heif_macos_arm/wheels.zip -o wheels.zip
27+
unzip wheels.zip
28+
29+
- name: Upload built wheels
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: wheels
33+
path: wheelhouse/*.whl
34+
if-no-files-found: error
35+
936
wheels_windows:
1037
name: windows • x86_64
1138
runs-on: windows-2019
@@ -277,7 +304,7 @@ jobs:
277304
path: wheelhouse/*.tar.gz
278305

279306
publish_release:
280-
needs: [wheels_windows, wheels_macos, wheels_linux_cpython, wheels_linux_pypy, sdist, wheels_armv7l]
307+
needs: [wheels_windows, wheels_macos, wheels_macos_arm, wheels_linux_cpython, wheels_linux_pypy, sdist, wheels_armv7l]
281308
name: Publish release
282309
runs-on: ubuntu-20.04
283310
env:
@@ -293,7 +320,7 @@ jobs:
293320

294321
- name: Publish wheels to PyPI
295322
run: |
296-
python3 -m pip install twine
297-
ls -la wheelhouse/
298-
python3 -m twine upload --skip-existing wheelhouse/*.whl
299-
python3 -m twine upload wheelhouse/*tar.gz
323+
ls -la wheelhouse/
324+
python3 -m pip install twine
325+
python3 -m twine upload --skip-existing wheelhouse/*.whl
326+
python3 -m twine upload --skip-existing wheelhouse/*tar.gz

.github/workflows/publish-pypi.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
1-
name: Build & Publish
2-
#Note: Wheels for the Apple M1 are assembled locally and manually uploaded.
1+
name: Publish • Pillow-Heif
32

43
on:
5-
workflow_dispatch:
4+
workflow_run:
5+
workflows: [Publish]
6+
types:
7+
- completed
68

79
jobs:
10+
wheels_macos_arm:
11+
name: macosx • aarch64
12+
runs-on: ubuntu-20.04
13+
14+
steps:
15+
- name: Waiting for Cirrus CI
16+
uses: lewagon/[email protected]
17+
with:
18+
ref: ${{ github.ref }}
19+
check-name: 'macosx • aarch64 • Cirrus'
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
wait-interval: 10
22+
23+
- name: Download artifacts
24+
run: |
25+
curl -L https://api.cirrus-ci.com/v1/artifact/github/${{ github.repository }}/wheel_macos_arm/wheels.zip -o wheels.zip
26+
unzip wheels.zip
27+
28+
- name: Upload built wheels
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: wheels
32+
path: wheelhouse/*.whl
33+
if-no-files-found: error
34+
835
wheels_armv7l:
936
name: ${{ matrix.i['name'] }} • ARMv7l • CPython
1037
runs-on: ubuntu-20.04
@@ -399,7 +426,7 @@ jobs:
399426
path: wheelhouse/*.tar.gz
400427

401428
create_release:
402-
needs: [sdist, wheels_macos, wheels_windows, wheels_linux_cpython,
429+
needs: [sdist, wheels_macos, wheels_macos_arm, wheels_windows, wheels_linux_cpython,
403430
wheels_linux_pypy, wheels_linux_pypy_32bit, wheels_linux_cpython_32bit,
404431
wheels_armv7l]
405432
runs-on: ubuntu-20.04
@@ -457,7 +484,7 @@ jobs:
457484

458485
- name: Publish wheels to PyPI
459486
run: |
460-
python3 -m pip install twine
461-
ls -la wheelhouse/
462-
python3 -m twine upload --skip-existing wheelhouse/*.whl
463-
python3 -m twine upload wheelhouse/*tar.gz
487+
ls -la wheelhouse/
488+
python3 -m pip install twine
489+
python3 -m twine upload --skip-existing wheelhouse/*.whl
490+
python3 -m twine upload --skip-existing wheelhouse/*tar.gz
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
publish_wheels:
9+
name: Publish triggered
10+
if: "contains(github.event.head_commit.message, '[publish]')"
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- run: echo "Publish triggered"

.github/workflows/test-wheels-pi_heif.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Wheels test(Pi-Heif)
33
on:
44
workflow_dispatch:
55
workflow_run:
6-
workflows: [Build & Publish(Pi-Heif)]
6+
workflows: [Publish • Pi-Heif]
77
types:
88
- completed
99

.github/workflows/test-wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Wheels test
33
on:
44
workflow_dispatch:
55
workflow_run:
6-
workflows: [Build & Publish, Publish(from GH Release)]
6+
workflows: [Publish • Pillow-Heif]
77
types:
88
- completed
99

ci/cirrus_wheels.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
wheel_macos_arm_task:
2+
only_if: $CIRRUS_BRANCH == 'master'
3+
name: macosx • aarch64 • Cirrus
4+
alias: wheel_macos_arm
5+
macos_instance:
6+
image: ghcr.io/cirruslabs/macos-monterey-xcode
7+
8+
env:
9+
PATH: /opt/homebrew/opt/[email protected]/bin:$PATH
10+
CIBW_SKIP: 'pp* cp36-* cp37-*'
11+
CIBW_BUILD: '*-macosx_arm64'
12+
CIBW_ARCHS: arm64
13+
CIBW_PLATFORM: macos
14+
CIBW_ENVIRONMENT: 'MACOSX_DEPLOYMENT_TARGET=12.0'
15+
16+
install_pre_requirements_script:
17+
- brew install [email protected]
18+
- ln -s python3 /opt/homebrew/opt/[email protected]/bin/python
19+
install_cibuildwheel_script:
20+
- python -m pip install cibuildwheel==2.11.4
21+
run_cibuildwheel_script:
22+
- cibuildwheel
23+
wheels_artifacts:
24+
path: "wheelhouse/*"
25+
26+
wheel_pi_heif_macos_arm_task:
27+
only_if: $CIRRUS_BRANCH == 'master'
28+
name: macosx • aarch64 • Pi-Heif • Cirrus
29+
alias: wheel_pi_heif_macos_arm
30+
macos_instance:
31+
image: ghcr.io/cirruslabs/macos-monterey-xcode
32+
33+
env:
34+
PATH: /opt/homebrew/opt/[email protected]/bin:$PATH
35+
CIBW_SKIP: 'pp* cp36-* cp37-*'
36+
CIBW_BUILD: '*-macosx_arm64'
37+
CIBW_ARCHS: arm64
38+
CIBW_PLATFORM: macos
39+
CIBW_ENVIRONMENT: 'MACOSX_DEPLOYMENT_TARGET=12.0'
40+
41+
install_pre_requirements_script:
42+
- brew install [email protected]
43+
- ln -s python3 /opt/homebrew/opt/[email protected]/bin/python
44+
install_cibuildwheel_script:
45+
- python -m pip install cibuildwheel==2.11.4
46+
transform_to_pi_heif_script:
47+
- cp -r -v ./pi-heif/* .
48+
- python3 .github/transform_to-pi_heif.py
49+
run_cibuildwheel_script:
50+
- cibuildwheel
51+
wheels_artifacts:
52+
path: "wheelhouse/*"

0 commit comments

Comments
 (0)