This commit is contained in:
Scott Lessans 2025-08-05 11:41:19 -07:00
parent 64bca4cf32
commit 0c69fd960d
2 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,67 @@
name: Run Rust and Python tests
description: Format, clippy, Rust tests (incl. doctests), build Python extension and run pytest
inputs:
python-version:
description: Python version to use
required: false
default: "3.11"
rust-toolchain:
description: Rust toolchain channel
required: false
default: stable
runs:
using: composite
steps:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ inputs.rust-toolchain }}
components: clippy,rustfmt
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip
- name: Install build/test deps
shell: bash
run: |
python -m pip install maturin pytest
- name: Check rustfmt
shell: bash
run: |
cargo fmt --all --check
- name: Run clippy
shell: bash
run: |
cargo clippy --all-targets --all-features -- -D warnings
- name: Run Rust tests (unit/integration)
shell: bash
run: |
cargo test --all-targets --all-features
- name: Run Rust doctests
shell: bash
run: |
cargo test --doc
- name: Build Python extension (maturin develop)
shell: bash
run: |
maturin develop --release
- name: Run pytest
shell: bash
run: |
pytest -q

View file

@ -19,6 +19,20 @@ permissions:
contents: read
jobs:
tests:
name: Tests (fmt, clippy, cargo test, doctest, pytest)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Run composite test suite
uses: ./.github/actions/run-rust-python-tests
with:
python-version: "3.11"
rust-toolchain: stable
linux:
runs-on: ${{ matrix.platform.runner }}
strategy: