130 lines
3.8 KiB
YAML
130 lines
3.8 KiB
YAML
name: Build + Deploy
|
|
|
|
on:
|
|
push:
|
|
tags: ["*.*.*"]
|
|
# enables workflow to be run manually
|
|
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
# skip binary wheels for pypy (preferable to use pure-python) and 32-bit Linux
|
|
CIBW_SKIP: pp* cp*linux_i686
|
|
CIBW_ENVIRONMENT: FONTTOOLS_WITH_CYTHON=1
|
|
CIBW_TEST_REQUIRES: tox
|
|
# only test core fonttools library without extras for now, stuff like lxml or scipy
|
|
# create too many issues when testing on a large matrix of environments...
|
|
CIBW_TEST_COMMAND: "tox -c {package}/tox.ini -e py-cy-noextra --installpkg {wheel}"
|
|
|
|
jobs:
|
|
|
|
build_pure:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install setuptools wheel twine
|
|
- name: Build source distribution and pure-python wheel
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: pure
|
|
path: |
|
|
dist/*.whl
|
|
dist/*.tar.gz
|
|
|
|
build_wheels:
|
|
name: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
fail-fast: false
|
|
# macos-13 runners are still x86_64, macos-14 (latest) are arm64; we want to build
|
|
# the x86_64 wheel on/for x86_64 macs
|
|
matrix:
|
|
os: [macos-13, windows-latest, ubuntu-latest]
|
|
arch: [auto64]
|
|
include:
|
|
- os: macos-latest
|
|
arch: universal2
|
|
- os: windows-latest
|
|
arch: auto32
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.x"
|
|
- name: Install dependencies
|
|
run: pip install cibuildwheel
|
|
|
|
- name: Build Wheels
|
|
run: python -m cibuildwheel --output-dir wheelhouse .
|
|
env:
|
|
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
|
|
CIBW_ARCHS: ${{ matrix.arch }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
|
|
path: wheelhouse/*.whl
|
|
|
|
build_arch_wheels:
|
|
name: py${{ matrix.python }} on ${{ matrix.arch }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
# aarch64 uses qemu so it's slow, build each py version in parallel jobs
|
|
python: [38, 39, 310, 311, 312, 313]
|
|
arch: [aarch64]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- uses: docker/setup-qemu-action@v3.3.0
|
|
with:
|
|
# temporarily pin to qemu@v8 to workaround non-determininstic gcc segfaults
|
|
# https://github.com/docker/setup-qemu-action/issues/188
|
|
image: tonistiigi/binfmt:qemu-v8.1.5
|
|
platforms: all
|
|
- name: Install dependencies
|
|
run: pip install cibuildwheel
|
|
- name: Build Wheels
|
|
run: python -m cibuildwheel --output-dir wheelhouse .
|
|
env:
|
|
CIBW_BUILD: cp${{ matrix.python }}-*
|
|
CIBW_ARCHS: ${{ matrix.arch }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-py${{ matrix.python }}-linux-${{ matrix.arch }}
|
|
path: wheelhouse/*.whl
|
|
|
|
deploy:
|
|
name: Upload to PyPI on tagged commit
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build_pure
|
|
- build_wheels
|
|
- build_arch_wheels
|
|
# only run if the commit is tagged...
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
# so that all artifacts are downloaded in the same directory specified by 'path'
|
|
merge-multiple: true
|
|
path: dist
|
|
- uses: pypa/gh-action-pypi-publish@v1.12.3
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.PYPI_PASSWORD }}
|