Add `check` script

3c0ae5f7ad25539a1e825af61732cfcfdfdbc633
Runs all the checks.
Alexis Sellier committed ago 1 parent c86fbbb1
scripts/check added +27 -0
1 +
#!/usr/bin/env sh
2 +
set -eu
3 +
4 +
log="$(mktemp)"
5 +
trap 'rm -f "$log"' EXIT HUP INT TERM
6 +
7 +
run() {
8 +
  name="$1"
9 +
  shift
10 +
11 +
  if "$@" >"$log" 2>&1; then
12 +
    printf '✓ %s..\n' "$name"
13 +
    : >"$log"
14 +
    return 0
15 +
  fi
16 +
17 +
  printf 'x %s..\n' "$name"
18 +
  printf '%s\n' "check failed: $name" >&2
19 +
  cat "$log" >&2
20 +
  exit 1
21 +
}
22 +
23 +
run "format" cargo fmt --check
24 +
run "clippy" cargo clippy --all-targets --all-features
25 +
run "build" cargo build --all-targets --all-features
26 +
run "test" cargo test --all-targets --all-features
27 +
run "docs" env RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps --document-private-items