name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
name: fmt + clippy + test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - run: cargo fmt --all --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked --no-fail-fast
msrv:
name: MSRV from Cargo.toml
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 - name: Read rust-version
id: msrv
run: |
ver=$(sed -n 's/^rust-version *= *"\(.*\)"/\1/p' Cargo.toml)
test -n "$ver" || { echo "could not read rust-version from Cargo.toml"; exit 1; }
echo "version=$ver" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 with:
toolchain: ${{ steps.msrv.outputs.version }}
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - run: cargo check --locked --all-targets