| 1 |
name: Build + Deploy |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
tags: ["*.*.*"] |
| 6 |
# enables workflow to be run manually |
| 7 |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch |
| 8 |
workflow_dispatch: |
| 9 |
|
| 10 |
env: |
| 11 |
# skip binary wheels for pypy (preferable to use pure-python) and 32-bit Linux |
| 12 |
CIBW_SKIP: pp* cp*linux_i686 |
| 13 |
CIBW_ENVIRONMENT: FONTTOOLS_WITH_CYTHON=1 |
| 14 |
CIBW_TEST_REQUIRES: tox |
| 15 |
# only test core fonttools library without extras for now, stuff like lxml or scipy |
| 16 |
# create too many issues when testing on a large matrix of environments... |
| 17 |
CIBW_TEST_COMMAND: "tox -c {package}/tox.ini -e py-cy-noextra --installpkg {wheel}" |
| 18 |
|
| 19 |
jobs: |
| 20 |
|
| 21 |
build_pure: |
| 22 |
runs-on: ubuntu-latest |
| 23 |
steps: |
| 24 |
- uses: actions/checkout@v6 |
| 25 |
- name: Install uv |
| 26 |
uses: astral-sh/setup-uv@v7 |
| 27 |
- name: Build source distribution and pure-python wheel |
| 28 |
run: | |
| 29 |
uv build |
| 30 |
- uses: actions/upload-artifact@v6 |
| 31 |
with: |
| 32 |
name: pure |
| 33 |
path: | |
| 34 |
dist/*.whl |
| 35 |
dist/*.tar.gz |
| 36 |
|
| 37 |
build_wheels: |
| 38 |
name: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} |
| 39 |
runs-on: ${{ matrix.os }} |
| 40 |
defaults: |
| 41 |
run: |
| 42 |
shell: bash |
| 43 |
strategy: |
| 44 |
fail-fast: false |
| 45 |
# macos-15-intel runners are still x86_64, macos-14 (latest) are arm64; we want to build |
| 46 |
# the x86_64 wheel on/for x86_64 macs |
| 47 |
matrix: |
| 48 |
os: [macos-15-intel, windows-latest, ubuntu-latest] |
| 49 |
arch: [auto64] |
| 50 |
include: |
| 51 |
- os: macos-latest |
| 52 |
arch: universal2 |
| 53 |
- os: windows-latest |
| 54 |
arch: auto32 |
| 55 |
- os: ubuntu-24.04-arm |
| 56 |
arch: aarch64 |
| 57 |
steps: |
| 58 |
- uses: actions/checkout@v6 |
| 59 |
with: |
| 60 |
submodules: recursive |
| 61 |
- name: Set up Python |
| 62 |
uses: actions/setup-python@v6 |
| 63 |
with: |
| 64 |
python-version: "3.x" |
| 65 |
- name: Install dependencies |
| 66 |
run: pip install cibuildwheel |
| 67 |
|
| 68 |
- name: Build Wheels |
| 69 |
run: python -m cibuildwheel --output-dir wheelhouse . |
| 70 |
env: |
| 71 |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 |
| 72 |
CIBW_ARCHS: ${{ matrix.arch }} |
| 73 |
- uses: actions/upload-artifact@v6 |
| 74 |
with: |
| 75 |
name: wheels-${{ matrix.os }}-${{ matrix.arch }} |
| 76 |
path: wheelhouse/*.whl |
| 77 |
|
| 78 |
deploy: |
| 79 |
name: Upload to PyPI on tagged commit |
| 80 |
runs-on: ubuntu-latest |
| 81 |
needs: |
| 82 |
- build_pure |
| 83 |
- build_wheels |
| 84 |
# only run if the commit is tagged... |
| 85 |
if: startsWith(github.ref, 'refs/tags/') |
| 86 |
environment: |
| 87 |
name: publish-to-pypi |
| 88 |
url: https://pypi.org/p/fontTools |
| 89 |
permissions: |
| 90 |
id-token: write # IMPORTANT: mandatory for trusted publishing |
| 91 |
|
| 92 |
steps: |
| 93 |
- uses: actions/download-artifact@v7 |
| 94 |
with: |
| 95 |
# so that all artifacts are downloaded in the same directory specified by 'path' |
| 96 |
merge-multiple: true |
| 97 |
path: dist |
| 98 |
- name: Publish package distributions to PyPI |
| 99 |
uses: pypa/[email protected] |