name: rust-msrv

on: [push, pull_request]

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0

  RUSTFLAGS: -Dwarnings

  # setup sccache for Rust; see https://github.com/Mozilla-Actions/sccache-action
  SCCACHE_GHA_ENABLED: "true"
  RUSTC_WRAPPER: "sccache"

jobs:

  check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

    - uses: mozilla-actions/sccache-action@v0.0.7
    - name: Cache Cargo dependencies
      uses: Swatinem/rust-cache@v2

    - uses: dtolnay/rust-toolchain@stable
      with:
        toolchain: "1.74" # MSRV

    - run: cargo check --all-targets
