Skip to content

Commit 1712da9

Browse files
committed
Add cargo check script
We build against various targets on CI, in order to not abuse CI its nice to see if code is good before pushing. Add a script that runs `cargo check` with various combinations of features and targets in order to enable thorough checking of the project source code during development.
1 parent 622e539 commit 1712da9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

scripts/cargo-check.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
#
3+
# Run various invocations of cargo check
4+
5+
features=( "default" "compiler" "electrum" "esplora" "compact_filters" "key-value-db" "async-interface" "all-keys" "keys-bip39" )
6+
toolchains=( "+stable" "+1.45" "+nightly" )
7+
8+
main() {
9+
check_src
10+
check_all_targets
11+
}
12+
13+
# Check with all features, with various toolchains.
14+
check_src() {
15+
for toolchain in "${toolchains[@]}"; do
16+
cmd="cargo $toolchain clippy --all-targets --no-default-features"
17+
18+
for feature in "${features[@]}"; do
19+
touch_files
20+
$cmd --features "$feature"
21+
done
22+
done
23+
}
24+
25+
# Touch files to prevent cached warnings from not showing up.
26+
touch_files() {
27+
touch $(find . -name *.rs)
28+
}
29+
30+
main
31+
exit 0

0 commit comments

Comments
 (0)