Skip to content

Commit

Permalink
Build wheels for more platforms (celiagg#115)
Browse files Browse the repository at this point in the history
Adds a separate build workflow using CIBuildWheel and then integrates it into the release workflow.

This builds for CPython on Intel Mac, Intel Windows and Intel and ARM Linux (glibc only).
  • Loading branch information
corranwebster authored Apr 17, 2023
1 parent 5e298c8 commit 9ee4d37
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 42 deletions.
71 changes: 29 additions & 42 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,47 @@ name: Publish release to PyPI
on:
release:
types: [published]

env:
INSTALL_EDM_VERSION: 3.3.1
workflow_dispatch:

jobs:
build-sdist:
runs-on: ubuntu-latest

steps:
- name: Check out the release commit
uses: actions/checkout@v3
- name: Setup EDM
uses: enthought/setup-edm-action@v2
with:
edm-version: ${{ env.INSTALL_EDM_VERSION }}
- name: Install build environment
run: |
edm --config ci/.edm.yaml install -y --version 3.8 cython numpy
edm run -- pip install twine
- name: Build sdist
run: edm run -- python setup.py sdist
- name: Publish sdist to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
edm run -- python -m twine check dist/*.tar.gz
edm run -- python -m twine upload dist/*.tar.gz
build-and-publish-wheel-all:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

build-wheel-linux:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- name: Check out the release commit
uses: actions/checkout@v3
- name: Build manylinux Python wheels
uses: RalfG/[email protected]

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
build-requirements: 'cython numpy'
system-packages: 'zlib-devel'
pre-build-command: 'sh ci/build-wheel-deps.sh'
platforms: arm64
if: runner.os == 'Linux'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Python packages needed for wheel upload
run: |
python -m pip install --upgrade pip setuptools
python -m pip install twine
- name: Publish wheels to PyPI
python-version: '3.11'

- name: Build wheels
uses: pypa/[email protected]

- name: Archive build
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse
# don't need these kept for long
retention-days: 7

- name: Check and upload wheels
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m twine check dist/*-manylinux*.whl
python -m twine upload dist/*-manylinux*.whl
python -m pip install twine
python -m twine check --strict wheelhouse/*.whl
python -m twine upload wheelhouse/*.whl
38 changes: 38 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build wheels and archive

on:
- workflow_dispatch

jobs:
build-wheel-all:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Check out the release commit
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
if: runner.os == 'Linux'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Build wheels
uses: pypa/[email protected]

- name: Archive build
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse
# don't need these kept for long
retention-days: 7
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[build-system]
requires = ["cython", "oldest-supported-numpy", "setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
skip = 'pp* *-musllinux*'

[tool.cibuildwheel.linux]
archs = ['auto', 'aarch64']
before-all = "yum install -y freetype-devel harfbuzz-devel"

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,5 @@ def create_extension():
package_data={
'celiagg': ['data/*'],
},
python_requires=">=3.7",
)

0 comments on commit 9ee4d37

Please sign in to comment.