-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI job for linting using cargo clippy (#161)
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,43 @@ jobs: | |
- name: Rust linter | ||
# make this command fail if cargo fmt had to make changes | ||
run: cargo fmt && git diff-index --exit-code HEAD | ||
|
||
# Linting job (cargo-clippy) - completes and puts warnings inline in PR | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
needs: [build] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Linting job > Cache steps | ||
|
||
- name: Cache cargo registry | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/registry | ||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} | ||
|
||
- name: Cache cargo index | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/git | ||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }} | ||
|
||
- name: Cache cargo build | ||
uses: actions/cache@v1 | ||
with: | ||
path: target | ||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }} | ||
|
||
# Linting job > Install and run clippy steps | ||
|
||
- name: Install clippy | ||
run: rustup component add clippy | ||
|
||
- uses: actions-rs/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-targets --all-features -- -D warnings |