Files
catena/check.sh
T

41 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/sh
# Everything that has to pass before a commit leaves the machine.
#
# The same script runs locally and in CI, so there is one gate and not two
# that drift apart.
set -eu
cd "$(dirname "$0")"
say() { printf '\n== %s\n' "$1"; }
say "formatting"
cargo fmt --check
say "lints"
cargo clippy --workspace --all-targets --all-features -- -D warnings
say "tests"
cargo test --workspace
# The WebAssembly build is only ever compiled for wasm32, so `--all-features`
# above does not reach it: on any other target the module compiles to nothing.
say "webassembly"
if rustup target list --installed 2>/dev/null | grep -q wasm32-unknown-unknown; then
cargo clippy -p catena --features wasm --lib --target wasm32-unknown-unknown -- -D warnings
else
echo "skipped: rustup target add wasm32-unknown-unknown"
fi
say "docs"
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --quiet
say "documentation links"
if command -v python3 >/dev/null 2>&1; then
python3 tools/check-links.py
else
echo "skipped: no python3"
fi
printf '\nall clear\n'