|
| 1 | +name: Python wheels |
| 2 | + |
| 3 | +# Build abi3 wheels for the four engine packages across every supported |
| 4 | +# platform and (on a `python-v*` tag) publish them to PyPI via trusted |
| 5 | +# publishing. |
| 6 | +# |
| 7 | +# abi3-py39 means ONE wheel per (package, platform, arch) covers Python 3.9+, |
| 8 | +# so there is deliberately no Python-version axis. |
| 9 | +# |
| 10 | +# NOTE: no sdist is published. The rapier2d/3d engine crates share their |
| 11 | +# source via the repo-root `src/` tree (`[lib] path = "../../src/lib.rs"`), |
| 12 | +# which lives outside any vendored crate directory, and maturin's sdist |
| 13 | +# packer cannot reach parent paths (`..` is rejected in `include`). A source |
| 14 | +# build would therefore be incomplete. The wheel matrix below covers all |
| 15 | +# mainstream platforms; source builds use a full git checkout of the repo. |
| 16 | +# Restoring an sdist is tracked as a follow-up (needs an upstream layout |
| 17 | +# change or registry-based engine deps). |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: [master] |
| 21 | + tags: ["python-v*"] |
| 22 | + pull_request: |
| 23 | + branches: [master] |
| 24 | + paths: |
| 25 | + - "python/**" |
| 26 | + - ".github/workflows/python-wheels.yml" |
| 27 | + workflow_dispatch: |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read |
| 31 | + |
| 32 | +jobs: |
| 33 | + build: |
| 34 | + name: wheel ${{ matrix.package.name }} ${{ matrix.platform.target }} |
| 35 | + runs-on: ${{ matrix.platform.runner }} |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + package: |
| 40 | + - { dir: rapier-py-3d, name: rapier3d } |
| 41 | + - { dir: rapier-py-3d-f64, name: rapier3d-f64 } |
| 42 | + - { dir: rapier-py-2d, name: rapier2d } |
| 43 | + - { dir: rapier-py-2d-f64, name: rapier2d-f64 } |
| 44 | + platform: |
| 45 | + - { runner: ubuntu-latest, target: x86_64-unknown-linux-gnu, manylinux: auto } |
| 46 | + - { runner: ubuntu-latest, target: aarch64-unknown-linux-gnu, manylinux: auto } |
| 47 | + - { runner: ubuntu-latest, target: x86_64-unknown-linux-musl, manylinux: musllinux_1_2 } |
| 48 | + - { runner: ubuntu-latest, target: aarch64-unknown-linux-musl, manylinux: musllinux_1_2 } |
| 49 | + - { runner: macos-14, target: aarch64-apple-darwin } |
| 50 | + - { runner: windows-latest, target: x86_64-pc-windows-msvc } |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + - name: Build wheel |
| 54 | + uses: PyO3/maturin-action@v1 |
| 55 | + with: |
| 56 | + command: build |
| 57 | + target: ${{ matrix.platform.target }} |
| 58 | + manylinux: ${{ matrix.platform.manylinux }} |
| 59 | + args: --release --out dist -m python/${{ matrix.package.dir }}/Cargo.toml |
| 60 | + sccache: "true" |
| 61 | + - uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: wheels-${{ matrix.package.name }}-${{ matrix.platform.target }} |
| 64 | + path: dist |
| 65 | + |
| 66 | + publish: |
| 67 | + name: Publish to PyPI |
| 68 | + needs: [build] |
| 69 | + runs-on: ubuntu-latest |
| 70 | + if: startsWith(github.ref, 'refs/tags/python-v') |
| 71 | + environment: pypi |
| 72 | + permissions: |
| 73 | + id-token: write # OIDC for trusted publishing |
| 74 | + steps: |
| 75 | + - uses: actions/download-artifact@v4 |
| 76 | + with: |
| 77 | + path: dist |
| 78 | + pattern: "wheels-*" |
| 79 | + merge-multiple: true |
| 80 | + - name: Publish all four packages |
| 81 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 82 | + with: |
| 83 | + packages-dir: dist |
0 commit comments