diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-12-13 12:46:54 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-12-13 12:51:22 +0200 |
commit | 3c02f8aa84282a2f6070f2baa39492edf625ecca (patch) | |
tree | f72c524dbb3a56cb19b0e13c70a6956a62ee33a2 | |
parent | 0396bca41d72749f8ddbd4454a691431544155f9 (diff) | |
download | contractor2-3c02f8aa84282a2f6070f2baa39492edf625ecca.tar.gz |
test: add ./check script to build and run automated tests
-rwxr-xr-x | check | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -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." |