name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test (${{ matrix.os }} / ${{ matrix.toolchain }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]
include:
- os: ubuntu-latest
toolchain: "1.74"
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable (rustfmt + clippy)
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
test-python:
name: Test Python bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
if: hashFiles('python/Cargo.toml') != ''
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
if: hashFiles('python/Cargo.toml') != ''
- name: Set up Python
if: hashFiles('python/Cargo.toml') != ''
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
if: hashFiles('python/Cargo.toml') != ''
run: pip install maturin pytest pytest-benchmark scipy numpy
- name: Build and install integrate-py
if: hashFiles('python/Cargo.toml') != ''
working-directory: python
run: maturin build --release && pip install target/wheels/*.whl
- name: Run correctness tests
if: hashFiles('python/Cargo.toml') != ''
run: pytest python/tests/test_integrate.py -v -k "not bench"
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build rustdoc
run: cargo doc --no-deps