name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rust:
name: Rust ${{ matrix.toolchain }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, "1.85"]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: cargo fmt
if: matrix.toolchain == 'stable'
run: cargo fmt --all -- --check
- name: cargo clippy
if: matrix.toolchain == 'stable'
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: cargo check (no default features)
run: cargo check --workspace --no-default-features
- name: cargo check (all features)
run: cargo check --workspace --all-targets --all-features
- name: cargo test
run: cargo test --workspace --all-features