Build, Test, Format, and Lint #362
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
# Run weekly to keep Rust toolchain changes fresh | |
- cron: '0 0 * * 1' | |
name: "Build, Test, Format, and Lint" | |
env: | |
RUSTFLAGS: "--deny warnings" | |
jobs: | |
multiple_toolchains: | |
name: Multiple toolchain tasks | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install ${{ matrix.rust }} toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: clippy, rustfmt | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
# Uses `--all-targets` here to make sure that things like benchmarks | |
# still compile | |
- name: Build all targets | |
run: | | |
cargo build --all-targets --all-features | |
- name: Run the test suite | |
run: | | |
cargo test --all-features | |
- name: Check formatting | |
run: | | |
cargo fmt --all -- --check | |
- name: Check clippy lints | |
run: | | |
cargo clippy | |
# Only check building and clippy on MSRV since the other tasks are prone to | |
# problems from dev dependencies having higher MSRVs | |
msrv_only: | |
name: Check MSRV compilation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install MSRV toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.70.0 | |
components: clippy | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
# All targets isn't used here due to MSRV issues with `clap` | |
- name: Build all targets | |
run: | | |
cargo build --all-features | |
- name: Check clippy lints | |
run: | | |
cargo clippy | |
nightly_only: | |
name: Nightly only tasks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Pin to a specific nightly version since we only want it for being able | |
# to use unstable features, not because we _need_ the newest version. | |
# This makes caching actually viable for more than just a day | |
- name: Install nightly toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly-2023-10-01 | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
# Actually check the fuzzers so that they don't break silently | |
- name: Check parser fuzzers | |
run: | | |
cargo check --manifest-path keyvalues-parser/fuzz/Cargo.toml | |
- name: Check ser de fuzzers | |
run: | | |
cargo check --manifest-path keyvalues-serde/fuzz/Cargo.toml |