|
| 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: [ "master" ] |
| 15 | + pull_request: |
| 16 | + # The branches below must be a subset of the branches above |
| 17 | + branches: [ "master" ] |
| 18 | + schedule: |
| 19 | + - cron: '41 16 * * 6' |
| 20 | + |
| 21 | +jobs: |
| 22 | + rust-clippy-analyze: |
| 23 | + name: Run rust-clippy analyzing |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + contents: read |
| 27 | + - name: Run rust-clippy |
| 28 | + run: | |
| 29 | + # Check with default features |
| 30 | + cargo clippy --message-format=json | clippy-sarif | tee rust-clippy-results-default.sarif | sarif-fmt |
| 31 | + # Check with all features |
| 32 | + cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results-all.sarif | sarif-fmt |
| 33 | + # Check with no default features |
| 34 | + cargo clippy --no-default-features --message-format=json | clippy-sarif | tee rust-clippy-results-no-default.sarif | sarif-fmt |
| 35 | + continue-on-error: true |
| 36 | + - name: Checkout code |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Upload analysis results to GitHub |
| 40 | + uses: github/codeql-action/upload-sarif@v3 |
| 41 | + with: |
| 42 | + sarif_file: rust-clippy-results-*.sarif |
| 43 | + wait-for-processing: true |
| 44 | + components: clippy |
| 45 | + override: true |
| 46 | + |
| 47 | + - name: Install required cargo |
| 48 | + run: cargo install clippy-sarif sarif-fmt |
| 49 | + |
| 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 | + |
| 57 | + - name: Upload analysis results to GitHub |
| 58 | + uses: github/codeql-action/upload-sarif@v3 |
| 59 | + with: |
| 60 | + sarif_file: rust-clippy-results.sarif |
| 61 | + wait-for-processing: true |
0 commit comments