Skip to content

Commit

Permalink
Add clippy Workflow
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
  • Loading branch information
egibs committed Jun 9, 2024
1 parent 7cc0940 commit 74c1a14
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.78.0

permissions:
contents: read
Expand All @@ -30,7 +31,7 @@ jobs:
static.rust-lang.org:443
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
- run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=${{ env.RUST_VERSION }} -y
export PATH="$HOME/.cargo/bin:$PATH"
rustup default stable
rustup component add rustfmt
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: rust-clippy

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '40 12 * * 6'

env:
RUST_VERSION: 1.78.0

jobs:
rust-clippy:
name: Run rust-clippy
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
- name: Install Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=${{ env.RUST_VERSION }} -y
export PATH="$HOME/.cargo/bin:$PATH"
rustup default stable
rustup component add clippy
- name: Install required cargo
run: cargo install clippy-sarif sarif-fmt

- name: Run rust-clippy
run:
cargo clippy
--all-features
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@8f1a6fed33af5212fab8a999d004627ae8901d1b
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true

0 comments on commit 74c1a14

Please sign in to comment.