Python bindings #38
Workflow file for this run
This file contains hidden or 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
# This file is autogenerated by maturin v1.8.2 | |
# To update, run | |
# | |
# maturin generate-ci github | |
# | |
name: Python bindings | |
on: | |
push: | |
workflow_dispatch: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
check_format: | |
name: Check formatting of pySplashsurf crate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check formatting of pySplashsurf crate | |
run: cargo fmt -- --check | |
working-directory: pysplashsurf | |
generate-stub: | |
name: Run stub generator | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: moonrepo/setup-rust@v1 | |
- run: | | |
cargo run --bin stub_gen | |
working-directory: pysplashsurf | |
- name: Upload stub as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pysplashsurf.pyi | |
path: pysplashsurf/pysplashsurf/ | |
linux: | |
name: Build wheels for Linux | |
needs: generate-stub | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-24.04 | |
target: x86_64 | |
- runner: ubuntu-24.04 | |
target: x86 | |
- runner: ubuntu-24.04 | |
target: aarch64 | |
- runner: ubuntu-24.04 | |
target: armv7 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download stub artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pysplashsurf.pyi | |
path: pysplashsurf/pysplashsurf/ | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -m pysplashsurf/Cargo.toml | |
# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.platform.target }} | |
path: dist | |
windows: | |
name: Build wheels for Windows | |
needs: generate-stub | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: windows-latest | |
target: x64 | |
- runner: windows-latest | |
target: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download stub artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pysplashsurf.pyi | |
path: pysplashsurf/pysplashsurf/ | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
architecture: ${{ matrix.platform.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -m pysplashsurf\Cargo.toml | |
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-windows-${{ matrix.platform.target }} | |
path: dist | |
macos: | |
name: Build wheels for macOS | |
needs: generate-stub | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: macos-13 | |
target: x86_64 | |
- runner: macos-14 | |
target: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download stub artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pysplashsurf.pyi | |
path: pysplashsurf/pysplashsurf/ | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist -m pysplashsurf/Cargo.toml | |
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.platform.target }} | |
path: dist | |
sdist: | |
name: Build source distribution | |
needs: generate-stub | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download stub artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pysplashsurf.pyi | |
path: pysplashsurf/pysplashsurf/ | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist -m pysplashsurf/Cargo.toml | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist | |
publish: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }} | |
needs: [linux, windows, macos, sdist, tests] | |
permissions: | |
# Use to sign the release artifacts | |
id-token: write | |
# Used to upload release artifacts | |
contents: write | |
# Used to generate artifact attestation | |
attestations: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
#- name: Generate artifact attestation | |
# uses: actions/attest-build-provenance@v1 | |
# with: | |
# subject-path: 'wheels-*/*' | |
- name: Publish to PyPI | |
#if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --non-interactive --skip-existing wheels-*/* | |
build_wheel: | |
name: Build wheel for documentation and tests | |
runs-on: ubuntu-latest | |
outputs: | |
filename: ${{ steps.get_filename.outputs.file_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: x86_64 | |
args: --release --out dist -m pysplashsurf/Cargo.toml | |
manylinux: auto | |
- name: Get wheel name | |
id: get_filename | |
run: | | |
FILE_NAME=$(ls dist) | |
echo "file_name=$FILE_NAME" >> $GITHUB_OUTPUT | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: doc_tests_wheel | |
path: dist | |
docs: | |
name: Build documentation | |
needs: build_wheel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: doc_tests_wheel | |
path: dist/ | |
- name: Append output to file | |
run: | | |
echo "./dist/${{ needs.build_wheel.outputs.filename }}" >> pysplashsurf/pysplashsurf/docs/requirements.txt | |
- uses: ammaraskar/sphinx-action@8.2.3 | |
with: | |
docs-folder: "pysplashsurf/pysplashsurf/docs/" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: DocumentationHTML | |
path: pysplashsurf/pysplashsurf/docs/build/html/ | |
read_the_docs: | |
name: Read the Docs trigger | |
needs: [docs, publish] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger Read the Docs build | |
run: | | |
curl -X POST -d "branches=main" -d "token=${{ secrets.READTHEDOCS_TOKEN }}" https://app.readthedocs.org/api/v2/webhook/pysplashsurf/299116/ | |
tests: | |
name: Run pytest | |
needs: build_wheel | |
defaults: | |
run: | |
shell: bash -l {0} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: mamba-org/setup-micromamba@v2 | |
with: | |
environment-file: pysplashsurf/python_environment.yaml | |
init-shell: >- | |
bash | |
- run: | | |
conda info | |
conda list | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: doc_tests_wheel | |
path: dist/ | |
- run: pip install dist/${{ needs.build_wheel.outputs.filename }} | |
- name: Install splashsurf CLI | |
run: cargo install splashsurf | |
- name: Run pytest | |
uses: pavelzw/pytest-action@v2 | |
with: | |
verbose: true | |
emoji: false | |
job-summary: true | |
click-to-expand: true | |
report-title: 'Pytest Report' |