| 1 |
name: Build and upload to PyPI |
| 2 |
|
| 3 |
# Build on every branch push, tag push, and pull request change: |
| 4 |
on: [push, pull_request] |
| 5 |
# Alternatively, to publish when a (published) GitHub Release is created, use the following: |
| 6 |
# on: |
| 7 |
# push: |
| 8 |
# pull_request: |
| 9 |
# release: |
| 10 |
# types: |
| 11 |
# - published |
| 12 |
env: |
| 13 |
CIBW_BUILD_VERBOSITY: 3 |
| 14 |
#CIBW_TEST_COMMAND: python -m unittest discover {project}/tests |
| 15 |
# Disable building PyPy wheels on all platforms |
| 16 |
CIBW_SKIP: pp* |
| 17 |
|
| 18 |
jobs: |
| 19 |
# build_wheels: |
| 20 |
# name: Build wheels for ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 21 |
# runs-on: ${{ matrix.buildplat[0] }} |
| 22 |
# strategy: |
| 23 |
# # Ensure that a wheel builder finishes even if another fails |
| 24 |
# fail-fast: false |
| 25 |
# matrix: |
| 26 |
# buildplat: |
| 27 |
# - [ubuntu-latest, manylinux_x86_64, auto] |
| 28 |
# - [macos-latest, macosx_x86_64, x86_64] |
| 29 |
# # skip these for now, need more work |
| 30 |
# - [macos-latest, macosx_arm64, arm64] |
| 31 |
# # python: ["cp38", "cp39", "cp310", "cp311", "cp312"] |
| 32 |
# python: ["cp312"] |
| 33 |
|
| 34 |
# steps: |
| 35 |
# - uses: actions/checkout@v3 |
| 36 |
# with: |
| 37 |
# submodules: 'true' |
| 38 |
|
| 39 |
# - name: Build wheels |
| 40 |
# uses: pypa/[email protected] |
| 41 |
# env: |
| 42 |
# CIBW_ARCHS: ${{ matrix.buildplat[2] }} |
| 43 |
# CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 44 |
|
| 45 |
# - uses: actions/upload-artifact@v4 |
| 46 |
# with: |
| 47 |
# path: ./wheelhouse/*.whl |
| 48 |
|
| 49 |
build_sdist: |
| 50 |
name: Build source distribution |
| 51 |
runs-on: ubuntu-latest |
| 52 |
steps: |
| 53 |
- uses: actions/checkout@v3 |
| 54 |
with: |
| 55 |
submodules: 'true' |
| 56 |
|
| 57 |
- name: Build sdist |
| 58 |
run: pipx run build --sdist |
| 59 |
|
| 60 |
- uses: actions/upload-artifact@v4 |
| 61 |
with: |
| 62 |
path: dist/*.tar.gz |
| 63 |
|
| 64 |
upload_pypi: |
| 65 |
# needs: [build_wheels, build_sdist] |
| 66 |
needs: [build_sdist] |
| 67 |
runs-on: ubuntu-latest |
| 68 |
# upload to PyPI on every tag starting with 'v' |
| 69 |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 70 |
# alternatively, to publish when a GitHub Release is created, use the following rule: |
| 71 |
# if: github.event_name == 'release' && github.event.action == 'published' |
| 72 |
steps: |
| 73 |
- uses: actions/download-artifact@v4 |
| 74 |
with: |
| 75 |
# unpacks default artifact into dist/ |
| 76 |
# if `name: artifact` is omitted, the action will create extra parent dir |
| 77 |
name: artifact |
| 78 |
path: dist |
| 79 |
|
| 80 |
- uses: pypa/[email protected] |
| 81 |
with: |
| 82 |
user: __token__ |
| 83 |
password: ${{ secrets.PYPI_API_TOKEN }} |