From 0c69fd960d0f87c27d9591fc293c442a5af171f7 Mon Sep 17 00:00:00 2001 From: Scott Lessans Date: Tue, 5 Aug 2025 11:41:19 -0700 Subject: [PATCH] ci --- .../actions/run-rust-python-tests/action.yml | 67 +++++++++++++++++++ .github/workflows/CI.yml | 14 ++++ 2 files changed, 81 insertions(+) create mode 100644 .github/actions/run-rust-python-tests/action.yml diff --git a/.github/actions/run-rust-python-tests/action.yml b/.github/actions/run-rust-python-tests/action.yml new file mode 100644 index 0000000..ed62480 --- /dev/null +++ b/.github/actions/run-rust-python-tests/action.yml @@ -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 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 29518e7..38fcdb5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: