summaryrefslogtreecommitdiff
path: root/check
blob: 49b3a4f7e0c29fa26042e211607a00990cc18a48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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."