name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build (all features)
run: cargo build --release --all-features
- name: Run tests (all features)
run: cargo test --all-features
- name: Real data tests
if: hashFiles('real_data/*.mrc') != ''
run: cargo test --all-features --test real_data_tests
- name: Check formatting
run: cargo fmt --check --all
- name: Clippy
run: cargo clippy --all-features
- name: Doc build
run: cargo doc --all-features --no-deps
- name: Bench compilation
run: cargo bench --all-features --no-run
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: msrv-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: msrv-cargo-
- name: Install MSRV (1.85)
run: rustup toolchain install 1.85
- name: Build with MSRV
run: cargo +1.85 build --all-features