From 3c02f8aa84282a2f6070f2baa39492edf625ecca Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 13 Dec 2020 12:46:54 +0200 Subject: test: add ./check script to build and run automated tests --- check | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 check (limited to 'check') 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." -- cgit v1.2.1