name: Rust CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
check_and_test:
name: Check & Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout LFS objects
run: git lfs pull
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --workspace --all-targets --all-features --lib --bins -- -D warnings
- name: Run tests
run: cargo test --release --verbose
- name: Check visualization examples compile
run: cargo check --examples --features visualization
- name: Build release
run: cargo build --release --verbose