Skip to content

Commit 706d6e3

Browse files
committed
Added the 'clippy' target to Makefile + changed the GitHub CI 'check' job to invoke the 'clippy' target.
1 parent f0e1f65 commit 706d6e3

2 files changed

Lines changed: 18 additions & 23 deletions

File tree

.github/workflows/cargo-workflow.yaml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ on:
2525
required: true
2626

2727
jobs:
28-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29-
# Code formatting
30-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31-
format:
32-
name: cargo fmt
33-
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }}
34-
steps:
35-
- uses: actions/checkout@v7
36-
- uses: actions-rust-lang/setup-rust-toolchain@v1
37-
with:
38-
toolchain: ${{ inputs.TOOLCHAIN_MAX }}
39-
cache: false
40-
components: rustfmt
41-
- uses: actions-rust-lang/rustfmt@v1
42-
4328
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4429
# Code checks
4530
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -57,21 +42,22 @@ jobs:
5742
with:
5843
toolchain: ${{ matrix.rust }}
5944
cache: false
45+
components: rustfmt clippy
6046
- uses: awalsh128/cache-apt-pkgs-action@v1.6.1
6147
with:
6248
packages: pkgconf libtss2-dev uuid-dev libjson-c-dev libcurl4-openssl-dev
6349
version: v3-${{ matrix.architecture }}-${{ matrix.platform }}-${{ matrix.rust }}-${{ github.run_id }}-check
6450
- run: |
6551
pkgconf --path tss2-fapi
6652
pkgconf --cflags --libs tss2-fapi
67-
- run: make check
53+
- run: make clippy
6854

6955
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7056
# Examples
7157
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7258
examples:
7359
name: cargo example
74-
needs: [format, checks]
60+
needs: checks
7561
strategy:
7662
matrix:
7763
platform: ["${{ inputs.OS_VERS_MIN }}", "${{ inputs.OS_VERS_MAX }}"]
@@ -98,7 +84,7 @@ jobs:
9884
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9985
tests-native:
10086
name: cargo test
101-
needs: [format, checks]
87+
needs: checks
10288
strategy:
10389
matrix:
10490
platform: ["${{ inputs.OS_VERS_MIN }}", "${{ inputs.OS_VERS_MAX }}"]
@@ -125,7 +111,7 @@ jobs:
125111
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126112
tests-docker:
127113
name: docker tests
128-
needs: [format, checks]
114+
needs: checks
129115
strategy:
130116
matrix:
131117
branch: ["stable", "unstable", "bleeding-edge"]
@@ -144,7 +130,7 @@ jobs:
144130
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145131
benches:
146132
name: benchmarks
147-
needs: [format, checks]
133+
needs: checks
148134
strategy:
149135
matrix:
150136
platform: ["${{ inputs.OS_VERS_MIN }}", "${{ inputs.OS_VERS_MAX }}"]
@@ -171,7 +157,7 @@ jobs:
171157
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172158
codecov:
173159
name: codecov
174-
needs: [format, checks]
160+
needs: checks
175161
runs-on: ubuntu-${{ inputs.OS_VERS_MAX }}
176162
steps:
177163
- uses: actions/checkout@v7

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@ include tools/docker/docker.mk
44

55
DOCKER := $(foreach target,$(DOCKER_TARGETS),docker.$(target))
66

7-
.PHONY: all bench build check clean codecov docs examples fixup libtpms package publish tests $(DOCKER)
7+
.PHONY: all bench build check clean clippy codecov docs examples fixup fmt libtpms package publish tests $(DOCKER)
88

99
all: clean check build
1010

11+
fmt:
12+
cargo fmt --all
13+
1114
check:
12-
cargo check --release --locked --all-features --all-targets
15+
cargo fmt --all --check
16+
cargo check --no-default-features
17+
cargo check --release --all-features --all-targets
18+
19+
clippy: check
20+
cargo clippy --no-default-features -- -D warnings
21+
cargo clippy --all-features --all-targets -- -D warnings
1322

1423
fixup: check
1524
cargo upgrade && cargo update

0 commit comments

Comments
 (0)