summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
Diffstat (limited to 'check')
-rwxr-xr-xcheck52
1 files changed, 52 insertions, 0 deletions
diff --git a/check b/check
new file mode 100755
index 0000000..642dfbe
--- /dev/null
+++ b/check
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -eu
+
+verbose=false
+offline=
+if [ "$#" -gt 0 ]; then
+ case "$1" in
+ verbose | -v | --verbose)
+ verbose=true
+ shift
+ ;;
+ --offline)
+ offline=--offline
+ shift
+ ;;
+ esac
+fi
+
+hideok=
+
+if command -v chronic >/dev/null; then
+ hideok=chronic
+fi
+
+if $verbose; then
+ hideok=
+fi
+
+$hideok cargo check --all-targets $offline
+cargo clippy -q $offline
+$hideok cargo build --all-targets $offline
+$hideok cargo test $offline
+
+$hideok cargo fmt -- --check
+if command -v black >/dev/null; then
+ $hideok find . -type f -name '*.py' ! -name test.py -exec black --check '{}' +
+fi
+
+$hideok subplot docgen jt.subplot --output jt.html
+
+$hideok subplot codegen jt.subplot --output test.py
+rm -f test.log
+target="$(
+ cargo metadata --format-version=1 |
+ python3 -c 'import json, sys; o = json.load(sys.stdin); print (o["target_directory"])'
+)"
+if ! $hideok python3 test.py --log test.log --env "CARGO_TARGET_DIR=$target" "$@"; then
+ cat test.log
+fi
+
+echo "Everything seems to be in order."