ci(rust.yml/jobs/clippy): integrate with GitHub Code Scanning #1535
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: Cargo Build, Test, and Linting | |
on: | |
push: | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
format: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --check | |
clippy: | |
name: Run lints | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- run: cargo install clippy-sarif | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --all-targets --all-features --message-format=json | clippy-sarif | tee results.sarif | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v3 | |
if: success() || failure() | |
with: | |
sarif_file: results.sarif | |
build_and_test: | |
name: Build project and test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
toolchain: | |
- stable | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test --verbose | |
build_release: | |
name: Build project in release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
toolchain: | |
- stable | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo build --verbose --release | |
- name: Export executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pumpkin-${{ matrix.os }} | |
compression-level: 9 | |
path: target/${{ matrix.target }}/release/pumpkin* | |
clippy_release: | |
name: Run lints in release mode | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo install clippy-sarif | |
- run: cargo clippy --release --all-targets --all-features --message-format=json | clippy-sarif | tee results.sarif | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v3 | |
if: success() || failure() | |
with: | |
sarif_file: results.sarif |