name: python-wheels
on:
workflow_dispatch:
push:
tags: ["v*"]
pull_request:
paths:
- "src/python/**"
- "python/ruopus/**"
- "tools/build_python.py"
- "Cargo.toml"
- "pyproject.toml"
- ".github/workflows/python-wheels.yml"
jobs:
linux:
name: linux ${{ matrix.py }}
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
strategy:
fail-fast: false
matrix:
py: ["cp39-cp39", "cp310-cp310", "cp311-cp311", "cp312-cp312", "cp313-cp313"]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Build + patch wheel
run: |
PY=/opt/python/${{ matrix.py }}/bin/python
$PY -m pip install --upgrade pip maturin numpy
$PY tools/build_python.py --release -i "$PY"
- name: Repair to manylinux
run: |
/opt/python/${{ matrix.py }}/bin/pip install auditwheel
for whl in target/wheels/*.whl; do auditwheel repair "$whl" -w dist/; done
# Re-patch stubs in the repaired wheel (auditwheel rewrites the wheel).
/opt/python/${{ matrix.py }}/bin/python tools/build_python.py --patch-only dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.py }}
path: dist/*.whl
macos-windows:
name: ${{ matrix.os }} ${{ matrix.py }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
py: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- uses: dtolnay/rust-toolchain@stable
- name: Build + patch wheel
run: |
python -m pip install --upgrade pip maturin numpy
python tools/build_python.py --release
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.py }}
path: target/wheels/*.whl
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: pipx run maturin sdist -o dist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz