]> Untitled Git - bdk/commitdiff
Add cargo check script
authorTobin Harding <me@tobin.cc>
Wed, 10 Feb 2021 00:18:39 +0000 (11:18 +1100)
committerTobin Harding <me@tobin.cc>
Wed, 24 Feb 2021 02:30:49 +0000 (13:30 +1100)
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.

scripts/cargo-check.sh [new file with mode: 0755]

diff --git a/scripts/cargo-check.sh b/scripts/cargo-check.sh
new file mode 100755 (executable)
index 0000000..01b9441
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Run various invocations of cargo check
+
+features=( "default" "compiler" "electrum" "esplora" "compact_filters" "key-value-db" "async-interface" "all-keys" "keys-bip39" )
+toolchains=( "+stable" "+1.45" "+nightly" )
+
+main() {
+    check_src
+    check_all_targets
+}
+
+# Check with all features, with various toolchains.
+check_src() {
+    for toolchain in "${toolchains[@]}"; do
+        cmd="cargo $toolchain clippy --all-targets --no-default-features"
+
+        for feature in "${features[@]}"; do
+            touch_files
+            $cmd --features "$feature"
+        done
+    done
+}
+
+# Touch files to prevent cached warnings from not showing up.
+touch_files() {
+    touch $(find . -name *.rs)
+}
+
+main
+exit 0