summaryrefslogtreecommitdiff
path: root/check
blob: 8330c2b0c6e1e9e8320e56996bc752b3412b1890 (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
#!/bin/sh

set -eu

codegen() {
    cargo run -q --bin sp-codegen -- "$1" --output "$2" --run \
          --templates "$(pwd)/templates"
}

docgen() {
    cargo run -q --bin sp-docgen -- "$1" --output "$2"
}

cargo build --all-targets
if cargo --list | awk '{ print $1 }' | grep 'clippy$' > /dev/null
then
    cargo clippy
fi
cargo test

if command -v rustfmt > /dev/null
then
    find src -type f -name '*.rs' -exec rustfmt --check '{}' +
fi

for md in [^R]*.md
do
    echo "$md ====================================="
    codegen "$md" test.py
    docgen "$md" "$(basename "$md" .md).pdf"
    docgen "$md" "$(basename "$md" .md).html"
    echo
done

echo "Everything seems to be in order."