name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
test:
name: test (${{ matrix.toolchain }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta, "1.88.0"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Format
if: matrix.toolchain == 'stable'
run: cargo fmt --all -- --check
- name: Clippy
if: matrix.toolchain == 'stable'
run: cargo clippy --all-targets -- -Dwarnings
- name: Build
run: cargo build --all-targets
- name: Test
run: cargo test --all-targets
- name: Doc tests
run: cargo test --doc
- name: Build (no-default-features, library-only)
if: matrix.toolchain == 'stable'
run: cargo build --no-default-features --lib