11name : CI
22
3+ permissions :
4+ security-events : write # needed to upload SARIF reports on branch builds
5+
36on :
47 push :
58 branches : [ "master" ]
2023 with :
2124 toolchain : ${{ matrix.rust }}
2225 components : rustfmt clippy
26+ - name : Install required cargo components
27+ run : cargo +stable install clippy-sarif sarif-fmt
2328 - name : build
2429 run : cargo build --features ${{ matrix.features }}
2530 - name : check
@@ -28,10 +33,16 @@ jobs:
2833 run : cargo test --features ${{ matrix.features }}
2934 - name : check formatting
3035 run : cargo fmt --all -- --check
31- - name : clippy
32- run : cargo clippy --features ${{ matrix.features }}
3336 - name : audit
3437 run : cargo audit
38+ - name : clippy (lib)
39+ run : cargo clippy --features ${{ matrix.features }} --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
40+ continue-on-error : true
41+ - name : Upload analysis results to GitHub
42+ uses : github/codeql-action/upload-sarif@v2
43+ with :
44+ sarif_file : rust-clippy-results.sarif
45+ wait-for-processing : true
3546
3647 stm32f4-event-printer :
3748 runs-on : ubuntu-latest
4253 with :
4354 targets : thumbv7em-none-eabihf
4455 components : rustfmt clippy
45- - name : Install flip-link
46- run : cargo install flip-link
56+ - name : Install required cargo components
57+ run : cargo install clippy-sarif sarif-fmt flip-link
4758 - name : build
4859 run : cargo build
4960 working-directory : examples/stm32f4-event-printer
5465 - name : check formatting
5566 run : cargo fmt --all -- --check
5667 working-directory : examples/stm32f4-event-printer
57- - name : clippy
58- run : cargo clippy
59- working-directory : examples/stm32f4-event-printer
6068 - name : audit
6169 run : cargo audit
6270 working-directory : examples/stm32f4-event-printer
71+ - name : clippy (example)
72+ # see the following comment for the patching workaround: https://github.com/psastras/sarif-rs/issues/370#issuecomment-1475364427
73+ run : |
74+ cargo clippy --message-format=json | \
75+ clippy-sarif | \
76+ jq --arg pwd "examples/stm32f4-event-printer" '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= $pwd + "/" + .' | \
77+ tee rust-clippy-results.sarif | \
78+ sarif-fmt
79+ working-directory : examples/stm32f4-event-printer
80+ - name : Upload analysis results to GitHub
81+ uses : github/codeql-action/upload-sarif@v2
82+ with :
83+ sarif_file : examples/stm32f4-event-printer/rust-clippy-results.sarif
84+ wait-for-processing : true
0 commit comments