name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
rust:
runs-on: ubuntu-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
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
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Build and test Python bindings
run: |
python -m venv .venv
.venv/bin/pip install maturin pytest
cd py && ../.venv/bin/maturin develop --features python
../.venv/bin/python -m pytest tests/