1: # This workflow uses actions that are not certified by GitHub.
2: # They are provided by a third-party and are governed by
3: # separate terms of service, privacy policy, and support
4: # documentation.
5: # rust-clippy is a tool that runs a bunch of lints to catch common
6: # mistakes in your Rust code and help improve your Rust code.
7: # More details at https://github.com/rust-lang/rust-clippy
8: # and https://rust-lang.github.io/rust-clippy/
9:
10: name: rust-clippy analyze
11:
12: on:
c4797b7b7c 2024-08-11 13: push:
c4797b7b7c 2024-08-11 14: branches: [ "master" ]
c4797b7b7c 2024-08-11 15: pull_request:
c4797b7b7c 2024-08-11 16: # The branches below must be a subset of the branches above
c4797b7b7c 2024-08-11 17: branches: [ "master" ]
c4797b7b7c 2024-08-11 18: schedule:
c4797b7b7c 2024-08-11 19: - cron: '43 14 * * 2'
20:
21: jobs:
c4797b7b7c 2024-08-11 22: rust-clippy-analyze:
c4797b7b7c 2024-08-11 23: name: Run rust-clippy analyzing
c4797b7b7c 2024-08-11 24: runs-on: ubuntu-latest
c4797b7b7c 2024-08-11 25: permissions:
c4797b7b7c 2024-08-11 26: contents: read
c4797b7b7c 2024-08-11 27: security-events: write
c4797b7b7c 2024-08-11 28: actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
c4797b7b7c 2024-08-11 29: steps:
c4797b7b7c 2024-08-11 30: - name: Checkout code
c4797b7b7c 2024-08-11 31: uses: actions/checkout@v4
c4797b7b7c 2024-08-11 32:
c4797b7b7c 2024-08-11 33: - name: Install Rust toolchain
c4797b7b7c 2024-08-11 34: uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
c4797b7b7c 2024-08-11 35: with:
c4797b7b7c 2024-08-11 36: profile: minimal
c4797b7b7c 2024-08-11 37: toolchain: stable
c4797b7b7c 2024-08-11 38: components: clippy
c4797b7b7c 2024-08-11 39: override: true
c4797b7b7c 2024-08-11 40:
c4797b7b7c 2024-08-11 41: - name: Install required cargo
c4797b7b7c 2024-08-11 42: run: cargo install clippy-sarif sarif-fmt
c4797b7b7c 2024-08-11 43:
c4797b7b7c 2024-08-11 44: - name: Run rust-clippy
c4797b7b7c 2024-08-11 45: run:
c4797b7b7c 2024-08-11 46: cargo clippy
c4797b7b7c 2024-08-11 47: --all-features
c4797b7b7c 2024-08-11 48: --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
c4797b7b7c 2024-08-11 49: continue-on-error: true
c4797b7b7c 2024-08-11 50:
c4797b7b7c 2024-08-11 51: - name: Upload analysis results to GitHub
c4797b7b7c 2024-08-11 52: uses: github/codeql-action/upload-sarif@v3
c4797b7b7c 2024-08-11 53: with:
c4797b7b7c 2024-08-11 54: sarif_file: rust-clippy-results.sarif
c4797b7b7c 2024-08-11 55: wait-for-processing: true