Update python-package.yml #88
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: Build & Publish wheels | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install | |
run: pip install . | |
- name: Install dependencies | |
run: pip install pytest pillow | |
- name: Test | |
run: pytest -vs ./tests | |
build_sdist: | |
name: Build source distribution | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
build_wheels: | |
needs: [test] | |
strategy: | |
matrix: | |
# macos-13 is an intel runner, macos-14 is apple silicon | |
os: [ubuntu-latest, windows-latest, macos-13] | |
cp: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312", "cp313"] | |
name: Build ${{ matrix.cp }} wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: joerick/[email protected] | |
env: | |
CIBW_ARCHS_LINUX: auto aarch64 | |
CIBW_ARCHS_MACOS: x86_64 arm64 universal2 | |
CIBW_BUILD: | | |
${{ matrix.cp }}-manylinux_x86_64 | |
${{ matrix.cp }}-manylinux_i686 | |
${{ matrix.cp }}-manylinux_aarch64 | |
${{ matrix.cp }}-win_amd64 | |
${{ matrix.cp }}-win32 | |
${{ matrix.cp }}-macosx_x86_64 | |
${{ matrix.cp }}-macosx_arm64 | |
${{ matrix.cp }}-macosx_universal2 | |
CIBW_TEST_REQUIRES: pytest pillow | |
CIBW_TEST_COMMAND: pytest -v -s {package}/tests | |
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-win32 *-manylinux_i686" | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
name: Publish to PyPI | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true |