-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit.sh
More file actions
executable file
·53 lines (36 loc) · 1.54 KB
/
Copy pathpre-commit.sh
File metadata and controls
executable file
·53 lines (36 loc) · 1.54 KB
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
51
52
53
#!/usr/bin/env bash
shopt -s nullglob
set -euo pipefail
readonly PBT_FEATURES='pbt/num-bigint pbt/serde_json'
echo
echo 'Running tests...'
cargo test --features "${PBT_FEATURES}" --bins --examples --lib --quiet --tests --workspace
echo 'Running doc-tests...'
cargo test --features "${PBT_FEATURES}" --doc --quiet --workspace
echo 'Running tests with coverage...'
cargo llvm-cov test --all-features --bins --examples --lib --quiet --tests --workspace --no-report -- --test-threads=1
echo
echo 'Linting with Clippy...'
cargo clippy --all-features --all-targets --quiet --workspace
echo
echo 'Checking for `&_` patterns...'
if rg --line-number --glob '*.rs' '\b(let|match)[[:space:]]+&' .; then
echo 'Use a dereferenced scrutinee and `ref` bindings instead.' >&2
exit 1
fi
echo
echo 'Checking the Nix flake...'
nix flake check --quiet --no-warn-dirty 2> >(
grep -v -E \
-e '^warning: The check omitted these incompatible systems: ' \
-e "^Use '--all-systems' to check all\\.$" >&2
)
echo
echo 'Running tests with Miri...'
MIRIFLAGS='-Zmiri-disable-isolation' cargo miri test --features "${PBT_FEATURES}" --bins --examples --lib --quiet --tests --workspace # TODO: `miri` seems not to be available via Nix/Crane
echo
echo 'Running doc-tests with Miri...'
MIRIFLAGS='-Zmiri-disable-isolation' cargo miri test --features "${PBT_FEATURES}" --doc --quiet --workspace # TODO: `miri` seems not to be available via Nix/Crane
echo
echo 'Running mutation testing...'
PBT_CACHE_DIR="$(pwd)/.pbt" cargo mutants --features "${PBT_FEATURES}" -j8