Skip to content

Commit 6842283

Browse files
committed
build: Universal macOS wheels supporting CPython 3.6 & 3.7 on Apple Silicon
1 parent 8e30073 commit 6842283

3 files changed

Lines changed: 49 additions & 4 deletions

File tree

.github/workflows/python-release.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
wheels:
10-
name: "Create wheels for ${{ matrix.BUILD.NAME }}"
10+
name: "Wheels for ${{ matrix.BUILD.NAME }}"
1111
runs-on: ${{ matrix.BUILD.OS }}
1212
strategy:
1313
fail-fast: false
@@ -74,8 +74,48 @@ jobs:
7474
name: Distribution Artifacts
7575
path: wheelhouse/*.whl
7676

77+
wheels-macos-universal:
78+
# `cibuildwheel` does not support building CPython 3.6/3.7 wheels for macOS ARM64
79+
# This job build universal wheel that covers these versions.
80+
# Non-universal wheels are also in place, because they have smaller size & will be used in Python 3.8+ installations
81+
name: "Wheels for macOS universal2"
82+
runs-on: macos-11
83+
steps:
84+
- uses: actions/checkout@v2
85+
- name: Setup python
86+
run: |
87+
curl "$PYTHON_DOWNLOAD_URL" -o python.pkg
88+
sudo installer -pkg python.pkg -target /
89+
env:
90+
PYTHON_DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.10.0/python-3.10.0post2-macos11.pkg'
91+
- uses: actions-rs/toolchain@v1
92+
with:
93+
profile: minimal
94+
toolchain: stable
95+
override: true
96+
default: true
97+
target: aarch64-apple-darwin
98+
- run: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m venv venv
99+
- run: venv/bin/pip install -U pip wheel setuptools-rust
100+
- run: mkdir wheelhouse
101+
- name: Build the wheel
102+
run: |
103+
cd bindings/python && \
104+
../../venv/bin/python setup.py bdist_wheel --py-limited-api=cp36 && \
105+
mv dist/css_inline*.whl ../../wheelhouse
106+
env:
107+
MACOSX_DEPLOYMENT_TARGET: '10.10'
108+
ARCHFLAGS: '-arch x86_64 -arch arm64'
109+
_PYTHON_HOST_PLATFORM: 'macosx-10.9-universal2'
110+
- run: venv/bin/pip install -f wheelhouse --no-index css_inline
111+
- run: find venv/lib/*/site-packages/ -name 'css_inline*.so' -exec vtool -show {} \;
112+
- uses: actions/upload-artifact@v2
113+
with:
114+
name: Distribution Artifacts
115+
path: wheelhouse/*.whl
116+
77117
sdist:
78-
name: Create sdist package
118+
name: Sdist package
79119
runs-on: ubuntu-20.04
80120
steps:
81121
- uses: actions/checkout@v2
@@ -96,6 +136,7 @@ jobs:
96136
upload_to_pypi:
97137
needs:
98138
- wheels
139+
- wheels-macos-universal
99140
- sdist
100141
name: Upload Artifacts to PyPi
101142
runs-on: ubuntu-20.04

bindings/python/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- Universal macOS wheels supporting CPython 3.6 & 3.7 on Apple Silicon.
8+
59
## [0.8.0] - 2022-01-10
610

711
### Added

bindings/python/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ The following wheels are available:
115115

116116
| | manylinux<br/>musllinux<br/>x86_64 | manylinux<br/>musllinux<br/>aarch64 | macOS Intel | macOS ARM64 | Windows 64bit | Windows 32bit |
117117
|----------------|:----------------:|:-----------------:|:-----------:|:-----------:|:-------------:|:-------------:|
118-
| CPython 3.6 ||| ✔️ | N/A | ✔️ | ✔️ |
119-
| CPython 3.7 ||| ✔️ | N/A | ✔️ | ✔️ |
118+
| CPython 3.6 ||| ✔️ | ✔ ️ | ✔️ | ✔️ |
119+
| CPython 3.7 ||| ✔️ | | ✔️ | ✔️ |
120120
| CPython 3.8 ||| ✔️ | ✔️ | ✔️ | ✔️ |
121121
| CPython 3.9 ||| ✔️ | ✔️ | ✔️ | ✔️ |
122122
| CPython 3.10 ||| ✔️ | ✔️ | ✔️ | ✔️ |

0 commit comments

Comments
 (0)