Build and deploy at test.PyPI #13
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 and deploy at test.PyPI | |
# Manually start test building | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- setup.py | |
tags-ignore: # Don't trigger if not release | |
- '*' | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
buildplat: | |
- [ubuntu-latest, manylinux_x86_64] | |
- [macos-latest, macosx_x86_64] | |
- [macos-latest, macosx_arm64] | |
- [macos-latest, macosx_universal2] | |
- [windows-latest, win_amd64] | |
- [windows-latest, win32] | |
python: ["cp38", "cp39", "cp310", "cp311", "cp312", "pp38"] | |
exclude: | |
# Don't build PyPy 32-bit windows | |
- buildplat: [windows-latest, win32] | |
python: "pp38" | |
- buildplat: [macos-latest, macosx_arm64] | |
python: "pp38" | |
- buildplat: [macos-latest, macosx_universal2] | |
python: "pp38" | |
- buildplat: [windows-latest, win32] | |
python: "cp310" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' # update once build dependencies are available | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
CIBW_ARCHS: all | |
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels_artifact-${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: source_artifact | |
path: dist/*.tar.gz | |
publish: | |
name: Publish on PyPI | |
runs-on: ubuntu-latest | |
needs: [build_wheels, build_sdist] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels_artifact-* | |
path: dist | |
- uses: actions/download-artifact@v3 | |
with: | |
name: source_artifact | |
path: dist | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true |