summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck50
1 files changed, 50 insertions, 0 deletions
diff --git a/check b/check
new file mode 100755
index 0000000..49b3a4f
--- /dev/null
+++ b/check
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+set -euo pipefail
+
+verbose=false
+if [ "$#" -gt 0 ]
+then
+ case "$1" in
+ verbose | -v | --verbose)
+ verbose=true
+ shift
+ ;;
+ esac
+fi
+
+hideok=
+quiet=-q
+
+if command -v chronic > /dev/null
+then
+ hideok=chronic
+fi
+
+if $verbose
+then
+ quiet=
+ hideok=
+fi
+
+$hideok cargo check --all-targets
+if cargo --list | grep 'clippy$' > /dev/null
+then
+ cargo clippy $quiet
+fi
+$hideok cargo build --all-targets
+$hideok cargo test $quiet
+$hideok cargo fmt -- --check
+
+if command -v black > /dev/null
+then
+ $hideok find . -type f -name '*.py' ! -name test.py -exec black --check '{}' +
+fi
+
+sp-docgen contractor.md -o contractor.html
+sp-docgen contractor.md -o contractor.pdf
+sp-codegen contractor.md -o test.py
+rm -f test.log
+$hideok python3 test.py --log test.log "$@"
+
+echo "Everything seems to be in order."