| 1 |
name: Deploy sdist and wheels |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
pull_request: |
| 6 |
release: |
| 7 |
types: |
| 8 |
- published |
| 9 |
|
| 10 |
jobs: |
| 11 |
build_sdist: |
| 12 |
runs-on: ubuntu-latest |
| 13 |
steps: |
| 14 |
- name: Checkout source |
| 15 |
uses: actions/checkout@v6 |
| 16 |
|
| 17 |
- name: Create sdist |
| 18 |
shell: bash -l {0} |
| 19 |
run: | |
| 20 |
python -m pip install -q build |
| 21 |
python -m build -s |
| 22 |
|
| 23 |
- name: Upload sdist to build artifacts |
| 24 |
uses: actions/upload-artifact@v6 |
| 25 |
with: |
| 26 |
name: sdist |
| 27 |
path: dist/*.tar.gz |
| 28 |
|
| 29 |
build_wheels: |
| 30 |
name: "Build wheels on ${{ matrix.os }} ${{ matrix.arch }}" |
| 31 |
runs-on: ${{ matrix.os }} |
| 32 |
strategy: |
| 33 |
fail-fast: false |
| 34 |
matrix: |
| 35 |
include: |
| 36 |
- os: windows-2022 |
| 37 |
arch: "AMD64" |
| 38 |
- os: windows-11-arm |
| 39 |
arch: "ARM64" |
| 40 |
- os: macos-15-intel |
| 41 |
arch: "x86_64" |
| 42 |
- os: macos-14 |
| 43 |
arch: "arm64" |
| 44 |
- os: "ubuntu-24.04-arm" |
| 45 |
arch: "aarch64" |
| 46 |
- os: "ubuntu-24.04" |
| 47 |
arch: "x86_64" |
| 48 |
|
| 49 |
steps: |
| 50 |
- uses: actions/checkout@v6 |
| 51 |
- run: | |
| 52 |
git fetch --prune --unshallow |
| 53 |
|
| 54 |
- name: Build wheels |
| 55 |
uses: pypa/[email protected] |
| 56 |
env: |
| 57 |
CIBW_SKIP: "cp39-* cp310-* *-manylinux_i686 *-musllinux_i686 *-musllinux_aarch64 *-win32" |
| 58 |
CIBW_ARCHS: "${{ matrix.arch }}" |
| 59 |
CIBW_TEST_SKIP: "*_arm64" |
| 60 |
CIBW_ENABLE: cpython-freethreading |
| 61 |
|
| 62 |
- uses: actions/upload-artifact@v6 |
| 63 |
with: |
| 64 |
name: wheels-${{ matrix.os }}-${{ matrix.arch }} |
| 65 |
path: ./wheelhouse/*.whl |
| 66 |
|
| 67 |
upload_to_pypi: |
| 68 |
needs: [build_sdist, build_wheels] |
| 69 |
runs-on: ubuntu-latest |
| 70 |
steps: |
| 71 |
- name: Download sdist artifact |
| 72 |
uses: actions/download-artifact@v7 |
| 73 |
with: |
| 74 |
name: sdist |
| 75 |
path: dist |
| 76 |
- name: Download wheels artifact |
| 77 |
uses: actions/download-artifact@v7 |
| 78 |
with: |
| 79 |
pattern: wheels-* |
| 80 |
merge-multiple: true |
| 81 |
path: dist |
| 82 |
- name: Publish package to Test PyPI |
| 83 |
if: github.event.action != 'published' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') |
| 84 |
uses: pypa/[email protected] |
| 85 |
with: |
| 86 |
user: __token__ |
| 87 |
password: ${{ secrets.test_pypi_password }} |
| 88 |
repository_url: https://test.pypi.org/legacy/ |
| 89 |
- name: Publish package to PyPI |
| 90 |
if: github.event.action == 'published' |
| 91 |
uses: pypa/[email protected] |
| 92 |
with: |
| 93 |
user: __token__ |
| 94 |
password: ${{ secrets.pypi_password }} |