Skip to content

Commit bab0ac3

Browse files
committed
GH Workflow: publish clippy results
this should show the results directly on the PR rather than having to check the log of the action.
1 parent 235a43e commit bab0ac3

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

.github/workflows/CI.yml

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ jobs:
2828
run: cargo test ${{ matrix.features }}
2929
- name: check formatting
3030
run: cargo fmt --all -- --check
31-
- name: clippy
32-
run: cargo clippy ${{ matrix.features }}
3331
- name: audit
3432
run: cargo audit
3533

@@ -42,8 +40,8 @@ jobs:
4240
with:
4341
targets: thumbv7em-none-eabihf
4442
components: rustfmt clippy
45-
- name: Install flip-link
46-
run: cargo install flip-link
43+
- name: Install required cargo components
44+
run: cargo install clippy-sarif sarif-fmt flip-link
4745
- name: build
4846
run: cargo build
4947
working-directory: examples/stm32f4-single-motor-example
@@ -54,9 +52,40 @@ jobs:
5452
- name: check formatting
5553
run: cargo fmt --all -- --check
5654
working-directory: examples/stm32f4-single-motor-example
57-
- name: clippy
58-
run: cargo clippy
59-
working-directory: examples/stm32f4-single-motor-example
6055
- name: audit
6156
run: cargo audit
6257
working-directory: examples/stm32f4-single-motor-example
58+
- name: clippy (example)
59+
# see the following comment for the patching workaround: https://github.com/psastras/sarif-rs/issues/370#issuecomment-1475364427
60+
run: |
61+
cargo clippy --message-format=json | \
62+
clippy-sarif | \
63+
jq --arg pwd "examples/stm32f4-single-motor-example" '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= $pwd + "/" + .' | \
64+
tee rust-clippy-results.sarif | \
65+
sarif-fmt
66+
working-directory: examples/stm32f4-single-motor-example
67+
continue-on-error: true
68+
- name: Upload analysis results to GitHub
69+
uses: github/codeql-action/upload-sarif@v2
70+
with:
71+
sarif_file: examples/stm32f4-single-motor-example/rust-clippy-results.sarif
72+
wait-for-processing: true
73+
74+
clippy:
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v3
78+
- name: install rust toolchain
79+
uses: dtolnay/rust-toolchain@stable
80+
with:
81+
components: rustfmt clippy
82+
- name: Install required cargo components
83+
run: cargo install clippy-sarif sarif-fmt
84+
- name: clippy (lib)
85+
run: cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
86+
continue-on-error: true
87+
- name: Upload analysis results to GitHub
88+
uses: github/codeql-action/upload-sarif@v2
89+
with:
90+
sarif_file: rust-clippy-results.sarif
91+
wait-for-processing: true

0 commit comments

Comments
 (0)