example code from https://github.com/rougier/freetype-py/issues/193 #141
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
# based on https://github.com/joerick/cibuildwheel/blob/master/examples/github-minimal.yml | |
name: Build | |
on: | |
push: | |
branches: [master] | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
name: Build wheels on ${{ matrix.os }} ${{ matrix.name }} | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
cibw_build: "cp37-*" | |
cibw_archs_linux: "auto64" | |
cibw_archs_macos: "auto64" | |
- os: windows-latest | |
cibw_build: "cp37-*" | |
cibw_archs_linux: "auto64" | |
cibw_archs_macos: "auto64" | |
- os: macos-latest | |
cibw_build: "cp38-macosx_universal2" | |
cibw_archs_linux: "auto64" | |
cibw_archs_macos: "universal2" | |
name: '(universal2)' | |
- os: 'ubuntu-latest' | |
cibw_build: "cp37-manylinux*" | |
cibw_archs_linux: 'aarch64' | |
cibw_archs_macos: "auto64" | |
name: '(manylinux aarch64)' | |
qemu: true | |
- os: 'ubuntu-latest' | |
cibw_build: "cp37-musllinux*" | |
cibw_archs_linux: 'aarch64' | |
cibw_archs_macos: "auto64" | |
name: '(musllinux aarch64)' | |
qemu: true | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # unshallow fetch for setuptools-scm | |
- name: Set up QEMU | |
if: matrix.qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_build }} | |
CIBW_ARCHS: "auto64" | |
CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs_macos }} | |
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} | |
CIBW_ENVIRONMENT: "FREETYPEPY_BUNDLE_FT=yes PYTHON_ARCH=64" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 | |
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | |
CIBW_TEST_COMMAND: "pytest {project}/tests" | |
CIBW_TEST_REQUIRES: "pytest" | |
with: | |
output-dir: dist | |
- name: Upload distributions | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
publish: | |
name: Publish release to Pypi | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # unshallow fetch for setuptools-scm | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Download assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Build sdist | |
run: | | |
python setup.py sdist | |
- name: Publish package to PyPI | |
run: | | |
pip install twine | |
twine upload dist/* | |
env: | |
TWINE_USERNAME: ${{ secrets.pypi_username }} | |
TWINE_PASSWORD: ${{ secrets.pypi_password }} | |
test-pyinstaller: | |
name: Test pyinstaller hook | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Test pyinstaller hook | |
env: | |
FREETYPEPY_BUNDLE_FT: yes | |
PYTHON_ARCH: 64 | |
run: | | |
pip install pytest psutil pyinstaller>=4 | |
pip install . | |
pytest -v --pyargs freetype.__pyinstaller.tests |