Adding back support for arm64 macOS wheels. #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Conda Environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
python-version: ${{ matrix.python-version }} | |
environment-file: ci/environment.yaml | |
activate-environment: test-environment | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
pip install -e . | |
python selftest.py | |
build: | |
name: "Build wheels on ${{ matrix.os }} ${{ matrix.cibw_archs }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2019 | |
cibw_archs: "AMD64 ARM64" | |
- os: macos-11 | |
cibw_archs: "x86_64" | |
- os: macos-14 # The macos-14 runner is arm64, while up until macos-13 the runners are x86_64. | |
cibw_archs: "arm64" | |
- os: "ubuntu-20.04" | |
cibw_archs: "aarch64" | |
- os: "ubuntu-20.04" | |
cibw_archs: "x86_64" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
# See discussion here: https://github.com/actions/runner-images/issues/9256 | |
- name: Make sure pipx is installed for the arm64 macOS runners. | |
if: runner.os == 'macOS' && runner.arch == 'ARM64' | |
run: | | |
brew install pipx | |
pipx ensurepath | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_TEST_COMMAND: python {project}/selftest.py | |
CIBW_BEFORE_BUILD_LINUX: yum install -y freetype-devel | |
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *-win32 *-manylinux_i686 *-musllinux*" | |
CIBW_TEST_REQUIRES: numpy pillow pytest | |
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" | |
CIBW_ARCHS: "${{ matrix.cibw_archs }}" | |
# disable finding unintended freetype installations | |
CIBW_ENVIRONMENT_WINDOWS: "AGGDRAW_FREETYPE_ROOT=''" | |
- name: upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheelhouse | |
path: "./wheelhouse/*.whl" | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
- name: sdist | |
run: | | |
python -m pip install -U build pip | |
python -m build -s | |
- name: download | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheelhouse | |
path: dist | |
- name: Publish package to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |