Skip to content

Commit

Permalink
add clippy as well
Browse files Browse the repository at this point in the history
  • Loading branch information
duc-nx committed Aug 9, 2024
1 parent ab084ce commit d03cd64
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rust-cache
- name: Install tooling and use Rust cache
uses: ./.github/actions/rust-cache
- run: cargo fmt --all --check
- run: cargo check --bins --examples --tests --benches --all-targets --all-features

cargo-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rust-cache
- run: cargo clippy --all-targets --all-features
- run: cargo check -p example --target=riscv32i-unknown-none-elf
- run: cargo check --bins --examples --tests --benches --all-features

cargo-test:
needs: check-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rust-cache
- run: cargo test --bins --examples --tests --benches --all-targets --all-features
- name: Install tooling and use Rust cache
uses: ./.github/actions/rust-cache
- run: cargo test -p example --target=riscv32i-unknown-none-elf
- run: cargo test --bins --examples --tests --benches --all-features

test-smoke:
needs: check-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rust-cache
- name: Install tooling and use Rust cache
uses: ./.github/actions/rust-cache
- run: assets/scripts/smoke.sh examples/src/bin/fib3_profiling.rs
- run: assets/scripts/smoke.sh examples/src/bin/hello.rs

Expand All @@ -44,7 +42,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rust-cache
- name: Install tooling and use Rust cache
uses: ./.github/actions/rust-cache
- run: assets/scripts/test_sdk.sh examples/src/bin/hello.rs

detect-unused-crate:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/

name: rust-clippy analyze

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '33 20 * * 4'

jobs:
rust-clippy-analyze:
name: Run rust-clippy analyzing
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install tooling and use Rust cache
uses: ./.github/actions/rust-cache

- name: Install required cargo
run: cargo install clippy-sarif sarif-fmt

- name: Run rust-clippy
run:
cargo clippy
--all-features
--all-targets
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true

0 comments on commit d03cd64

Please sign in to comment.