|
| 1 | +--- |
| 2 | + |
| 3 | +# This workflow uses actions that are not certified by GitHub. |
| 4 | +# They are provided by a third-party and are governed by |
| 5 | +# separate terms of service, privacy policy, and support |
| 6 | +# documentation. |
| 7 | +# rust-clippy is a tool that runs a bunch of lints to catch common |
| 8 | +# mistakes in your Rust code and help improve your Rust code. |
| 9 | +# More details at https://github.com/rust-lang/rust-clippy |
| 10 | +# and https://rust-lang.github.io/rust-clippy/ |
| 11 | + |
| 12 | +name: rust-clippy analyze |
| 13 | + |
| 14 | +on: # yamllint disable-line rule:truthy |
| 15 | + push: |
| 16 | + branches: ["main", "develop", "feature/*"] |
| 17 | + pull_request: |
| 18 | + # The branches below must be a subset of the branches above |
| 19 | + branches: ["main"] |
| 20 | + schedule: |
| 21 | + - cron: '38 4 * * 0' |
| 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 | + # only required for a private repository |
| 31 | + # by github/codeql-action/upload-sarif to get the Action run status |
| 32 | + actions: read |
| 33 | + steps: |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Install Rust toolchain |
| 38 | + # @v1 |
| 39 | + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af |
| 40 | + with: |
| 41 | + profile: minimal |
| 42 | + toolchain: stable |
| 43 | + components: clippy |
| 44 | + override: true |
| 45 | + |
| 46 | + - name: Install required cargo |
| 47 | + run: cargo install clippy-sarif sarif-fmt |
| 48 | + |
| 49 | + # yamllint disable rule:line-length |
| 50 | + - name: Run rust-clippy |
| 51 | + run: > |
| 52 | + cargo clippy |
| 53 | + --all-features |
| 54 | + --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt |
| 55 | + continue-on-error: true |
| 56 | + # yamllint enable rule:line-length |
| 57 | + |
| 58 | + - name: Upload analysis results to GitHub |
| 59 | + uses: github/codeql-action/upload-sarif@v3 |
| 60 | + with: |
| 61 | + sarif_file: rust-clippy-results.sarif |
| 62 | + wait-for-processing: true |
0 commit comments