1
1
name : CI
2
2
3
+ permissions :
4
+ security-events : write # needed to upload SARIF reports on branch builds
5
+
3
6
on :
4
7
push :
5
8
branches : [ "master" ]
20
23
with :
21
24
toolchain : ${{ matrix.rust }}
22
25
components : rustfmt clippy
26
+ - name : Install required cargo components
27
+ run : cargo +stable install clippy-sarif sarif-fmt
23
28
- name : build
24
29
run : cargo build --features ${{ matrix.features }}
25
30
- name : check
@@ -28,10 +33,16 @@ jobs:
28
33
run : cargo test --features ${{ matrix.features }}
29
34
- name : check formatting
30
35
run : cargo fmt --all -- --check
31
- - name : clippy
32
- run : cargo clippy --features ${{ matrix.features }}
33
36
- name : audit
34
37
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
35
46
36
47
stm32f4-event-printer :
37
48
runs-on : ubuntu-latest
42
53
with :
43
54
targets : thumbv7em-none-eabihf
44
55
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
47
58
- name : build
48
59
run : cargo build
49
60
working-directory : examples/stm32f4-event-printer
54
65
- name : check formatting
55
66
run : cargo fmt --all -- --check
56
67
working-directory : examples/stm32f4-event-printer
57
- - name : clippy
58
- run : cargo clippy
59
- working-directory : examples/stm32f4-event-printer
60
68
- name : audit
61
69
run : cargo audit
62
70
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