forked from kaspanet/silverscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.sh
More file actions
executable file
·56 lines (50 loc) · 1.17 KB
/
Copy pathcheck.sh
File metadata and controls
executable file
·56 lines (50 loc) · 1.17 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
54
55
56
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
run_check() {
cargo check --tests --workspace --benches
}
run_tests() {
if cargo nextest --version >/dev/null 2>&1; then
cargo nextest run --release --workspace
else
cargo test --release --workspace
fi
}
run_lints() {
cargo fmt --all -- --check
cargo clippy --workspace --tests --benches --examples -- -D warnings
}
run_tree_sitter_tests() {
cargo test --manifest-path tree-sitter/Cargo.toml
}
case "${1:-all}" in
all)
cargo fmt --all
run_check
cargo clippy --workspace --tests --benches --examples -- -D warnings
run_tests
run_tree_sitter_tests
;;
check)
run_check
;;
test)
run_tests
;;
lint)
run_lints
;;
tree-sitter)
run_tree_sitter_tests
;;
-h|--help)
echo "Usage: ./check.sh [all|check|test|lint|tree-sitter]"
echo "The default 'all' check applies Rust formatting before validation."
;;
*)
echo "unknown check: $1" >&2
echo "try: ./check.sh --help" >&2
exit 2
;;
esac