scripts/check 714 B raw
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 --all --check
24
run "clippy" cargo clippy --workspace --all-features --lib --bins --tests -- -D warnings
25
run "build" cargo build --workspace --all-features --lib --bins --tests
26
run "test" env RUSTFLAGS="-D warnings" cargo test --workspace --all-features --lib --bins --tests
27
run "docs" env RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps --document-private-items