|
| 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: |
| 13 | + push: |
| 14 | + branches: ["main", "*"] |
| 15 | + paths: |
| 16 | + - "/**/*.rs" |
| 17 | + pull_request: |
| 18 | + # The branches below must be a subset of the branches above |
| 19 | + branches: ["main"] |
| 20 | + schedule: |
| 21 | + - cron: "50 23 * * *" |
| 22 | + |
| 23 | +jobs: |
| 24 | + rust-clippy-analyze: |
| 25 | + name: Run rust-clippy analyzing |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + security-events: write |
| 30 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 31 | + steps: |
| 32 | + - name: Checkout code |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Install Rust toolchain |
| 36 | + uses: dtolnay/rust-toolchain@stable |
| 37 | + with: |
| 38 | + toolchain: stable |
| 39 | + components: clippy, rustfmt |
| 40 | + |
| 41 | + - name: Install required cargo |
| 42 | + run: cargo install clippy-sarif sarif-fmt cargo-audit |
| 43 | + |
| 44 | + - name: Run rust-clippy |
| 45 | + run: cargo clippy |
| 46 | + --all-features |
| 47 | + --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt |
| 48 | + continue-on-error: true |
| 49 | + |
| 50 | + - name: Upload analysis results to GitHub |
| 51 | + uses: github/codeql-action/upload-sarif@v3 |
| 52 | + with: |
| 53 | + sarif_file: rust-clippy-results.sarif |
| 54 | + wait-for-processing: true |
0 commit comments