name: CI
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
on:
push:
pull_request:
jobs:
ci:
name: Build, test, lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build (debug)
run: cargo build --workspace --verbose
- name: Run tests (includes doctests)
run: cargo test --workspace --verbose
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Security audit (cargo audit)
run: cargo audit
continue-on-error: true
docs:
name: Build docs and upload artifact
runs-on: ubuntu-latest
needs: ci
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build docs
run: cargo doc --no-deps --workspace --verbose
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: rust-docs
path: target/doc