KER-1: Set up a pipeline for formatting & linting checks #5
Workflow file for this run
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
--- | |
name: "Check formatting and linting" | |
on: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "master" | |
env: | |
CARGO_TERM_COLOR: "always" | |
jobs: | |
format-and-lint: | |
name: "Check formatting and linting" | |
runs-on: ["ubuntu-latest"] | |
steps: | |
- id: "checkout" | |
name: "Checkout repository" | |
uses: "actions/checkout@v4" | |
with: | |
filter: "tree:0" | |
- id: "setup-toolchain" | |
name: "Install Rust toolchain" | |
uses: "dtolnay/rust-toolchain@master" | |
with: | |
toolchain: "stable" | |
- id: "setup-cache" | |
name: "Cache dependencies" | |
uses: "Swatinem/rust-cache@v2" | |
- id: "setup-sarif" | |
name: "Setup SARIF tools" | |
run: | | |
cargo install clippy-sarif sarif-fmt | |
- id: "fmt" | |
name: "Check formatting" | |
run: | | |
cargo fmt --all -- --check | |
- id: "run-clippy" | |
name: "Run Clippy" | |
run: > | |
cargo clippy --all-targets --all-features --message-format=json -- -D warnings | |
| clippy-sarif | |
| tee results.sarif | |
| sarif-fmt | |
- id: "upload-sarif" | |
name: "Upload SARIF file" | |
uses: "github/codeql-action/upload-sarif@v3" | |
with: | |
sarif_file: "results.sarif" | |
category: "rust-clippy" |