name: Rust CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
check-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo registry + build
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Rustfmt check
if: matrix.os == 'ubuntu-latest'
run: cargo fmt --all -- --check
- name: Clippy lint
if: matrix.os == 'ubuntu-latest'
run: cargo clippy --locked --all-targets --all-features -- -D warnings
- name: Check documentation
if: matrix.os == 'ubuntu-latest'
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc --locked --workspace --all-features --no-deps
- name: Build release
if: matrix.os == 'ubuntu-latest'
run: cargo build --locked --release
- name: Cargo check
run: cargo check --locked --all-targets --all-features
- name: Run unit tests
run: cargo test --locked --all-targets
- name: Run shuttle tests
run: cargo test --locked --all-targets --features shuttle shuttle_tests
minimal-versions:
name: Check minimal-versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Git Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
- name: Install minimal-version tools
uses: taiki-e/install-action@b20dedce73af6905cdc30d6611090c9b67557c8d with:
tool: cargo-hack,cargo-minimal-versions
- name: Run minimal-versions check
run: cargo minimal-versions check --direct --all-features