Skip to content

Commit 2bbc704

Browse files
authored
ci: run rust-clippy, send results to CodeQL (#161)
This adds a new analysis job to run Rust's code quality analyzer, `rust-clippy`, and upload the JSON results to GitHub's CodeQL service. This template was suggested by GitHub itself and I've modified it to fit our repository; let's see how this goes.
1 parent 48e75eb commit 2bbc704

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,38 @@ jobs:
7171
uses: github/codeql-action/analyze@e8893c57a1f3a2b659b6b55564fdfdbbd2982911 # v3.24.0
7272
with:
7373
category: "/language:${{matrix.language}}"
74+
75+
analyze_rust:
76+
name: Analyze (Rust)
77+
runs-on: ubuntu-latest
78+
defaults:
79+
run:
80+
working-directory: rust
81+
permissions:
82+
contents: read
83+
security-events: write
84+
steps:
85+
- name: Checkout repository
86+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87+
88+
- name: Install clippy
89+
run: rustup component add clippy
90+
91+
- name: Install cargo-binstall
92+
uses: cargo-bins/[email protected]
93+
94+
- name: Install dependencies
95+
run: cargo binstall --no-confirm clippy-sarif sarif-fmt
96+
97+
- name: Run clippy
98+
run: |
99+
cargo clippy --all-features --message-format=json > clippy.json
100+
clippy-sarif --input clippy.json --output clippy.sarif
101+
sarif-fmt --input clippy.sarif
102+
continue-on-error: true
103+
104+
- name: Upload analysis
105+
uses: github/codeql-action/upload-sarif@v3
106+
with:
107+
sarif_file: rust/clippy.sarif
108+
wait-for-processing: true

0 commit comments

Comments
 (0)