Publish clippy results in GitHub workflow #77
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
jobs: | |
lib: | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [1.63.0, stable] | |
features: ['', '--all-features'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt clippy | |
- name: build | |
run: cargo build ${{ matrix.features }} | |
- name: check | |
run: cargo check ${{ matrix.features }} | |
- name: test | |
run: cargo test ${{ matrix.features }} | |
- name: check formatting | |
run: cargo fmt --all -- --check | |
- name: audit | |
run: cargo audit | |
stm32f4-single-motor-example: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: thumbv7em-none-eabihf | |
components: rustfmt clippy | |
- name: Install required cargo components | |
run: cargo install clippy-sarif sarif-fmt flip-link | |
- name: build | |
run: cargo build | |
working-directory: examples/stm32f4-single-motor-example | |
- name: check | |
run: cargo check | |
working-directory: examples/stm32f4-single-motor-example | |
# no tests available for now => no test step as it'd fail otherwise | |
- name: check formatting | |
run: cargo fmt --all -- --check | |
working-directory: examples/stm32f4-single-motor-example | |
- name: audit | |
run: cargo audit | |
working-directory: examples/stm32f4-single-motor-example | |
- name: clippy (example) | |
run: cargo clippy --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
working-directory: examples/stm32f4-single-motor-example | |
continue-on-error: true | |
- name: Fix paths for example in clippy report | |
run: > | |
sed 's#"uri": "#"uri": "examples/stm32f4-single-motor-example#g' rust-clippy-results.sarif > examples-rust-clippy-results.sarif | |
working-directory: examples/stm32f4-single-motor-example | |
- name: upload clippy results of example | |
uses: actions/upload-artifact@v3 | |
with: | |
name: examples-rust-clippy-results | |
path: examples/stm32f4-single-motor-example/examples-rust-clippy-results.sarif | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt clippy | |
- name: Install required cargo components | |
run: cargo install clippy-sarif sarif-fmt | |
- name: clippy (lib) | |
run: cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
continue-on-error: true | |
- name: upload clippy results of library | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rust-clippy-results | |
path: rust-clippy-results.sarif | |
publish_clippy: | |
needs: [clippy, stm32f4-single-motor-example] | |
runs-on: ubuntu-latest | |
steps: | |
- name: download clippy results of library | |
uses: actions/download-artifact@v3 | |
with: | |
name: rust-clippy-results | |
- name: download clippy results of example | |
uses: actions/download-artifact@v3 | |
with: | |
name: examples-rust-clippy-results | |
- name: concat clippy results into single file | |
run: > | |
cat examples-rust-clippy-results.sarif >> rust-clippy-results.sarif | |
- name: show result | |
run: > | |
cat rust-clippy-results.sarif | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true |