Skip to content

Commit 30a6dc9

Browse files
committed
Run clippy from the test script
Currently we run clippy in CI using a github action. The invocation has a couple of shortcomings 1. it does not lint the tests (this requires `--all-targets`) 2. it does not lint the examples I could not find a way to lint the examples without explicitly linting each example by name. Move the clippy control to `test.sh` and add an env var `DO_LINT` to control it. Remove the explicit CI job and run the linter during the `Test` job using the stable toolchain.
1 parent 1efe245 commit 30a6dc9

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
- rust: stable
1414
env:
1515
DO_COV: true
16+
DO_LINT: true
1617
AS_DEPENDENCY: true
1718
DO_NO_STD: true
1819
- rust: beta
@@ -106,19 +107,3 @@ jobs:
106107
RUSTFLAGS: "-C link-arg=-Tlink.x"
107108
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
108109
run: cd embedded && cargo run --target thumbv7m-none-eabi
109-
110-
Clippy:
111-
name: Clippy
112-
runs-on: ubuntu-latest
113-
steps:
114-
- uses: actions/checkout@v2
115-
- uses: actions-rs/toolchain@v1
116-
with:
117-
profile: minimal
118-
toolchain: stable
119-
override: true
120-
- run: rustup component add clippy
121-
- uses: actions-rs/cargo@v1
122-
with:
123-
command: clippy
124-
args: --all-features -- -D warnings

contrib/test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ if [ "$duplicate_dependencies" -ne 0 ]; then
3131
exit 1
3232
fi
3333

34+
if [ "$DO_LINT" = true ]
35+
then
36+
cargo clippy --all-features --all-targets -- -D warnings
37+
cargo clippy --example bip32 -- -D warnings
38+
cargo clippy --example handshake -- -D warnings
39+
cargo clippy --example ecdsa-psbt --features=bitcoinconsensus -- -D warnings
40+
fi
41+
3442
echo "********* Testing std *************"
3543
# Test without any features other than std first
3644
cargo test --verbose --no-default-features --features="std"

0 commit comments

Comments
 (0)