name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
rust:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo test --all-features
- run: cargo test
- run: cargo package --no-verify
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-llvm-cov --locked
- run: cargo llvm-cov --all-features --summary-only
version-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Check version consistency (Cargo.toml / py/pyproject.toml / CITATION.cff / README.md)
run: |
RUST=$(grep '^version' Cargo.toml | head -1 | grep -oP '"\K[^"]+')
PY=$(grep '^version' py/pyproject.toml | grep -oP '"\K[^"]+')
CIT=$(grep '^version:' CITATION.cff | awk '{print $2}')
README=$(grep -oP 'Experimental — v\K[0-9]+\.[0-9]+\.[0-9]+' README.md | head -1)
echo "Rust=$RUST Python=$PY Citation=$CIT README=$README"
[ "$RUST" = "$PY" ] && [ "$RUST" = "$CIT" ] && [ "$RUST" = "$README" ] || \
{ echo "ERROR: version mismatch — bump Cargo.toml, py/pyproject.toml, CITATION.cff, and README.md together"; exit 1; }
python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Syntax check Python files
run: |
python -m py_compile \
py/causasv/__init__.py py/causasv/helpers.py py/causasv/plot.py \
py/tests/smoke_test.py \
examples/quality_workflow.py examples/benchmark_corpus.py
- name: Build and test Python bindings
run: |
python -m venv .venv
.venv/bin/pip install maturin pytest pytest-cov "ruff==0.16.9"
cd py && ../.venv/bin/maturin develop --features python
../.venv/bin/python -m pytest --cov=causasv --cov-report=term-missing tests/
- name: Lint Python files (ruff)
run: .venv/bin/ruff check py/ examples/
- name: Smoke test Python public API
run: |
cd py
../.venv/bin/python tests/smoke_test.py
- name: Run quality_workflow example (no matplotlib)
run: |
cd py
../.venv/bin/python ../examples/quality_workflow.py
- name: Run benchmark_corpus example (no matplotlib)
run: |
cd py
../.venv/bin/python ../examples/benchmark_corpus.py