-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathrun_local_ci.sh
More file actions
executable file
·93 lines (79 loc) · 2.29 KB
/
run_local_ci.sh
File metadata and controls
executable file
·93 lines (79 loc) · 2.29 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env bash
set -euo pipefail
SANDBOX_MODE=0
ALLOW_TEMP_CHECKS=1
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--sandbox)
SANDBOX_MODE=1
ALLOW_TEMP_CHECKS=0
shift
;;
--with-temp-checks)
ALLOW_TEMP_CHECKS=1
shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
# Determine repo root relative to this script's location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$SCRIPT_DIR"
# If you put this script in a subdir (e.g., scripts/), uncomment the next line:
# REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$REPO_ROOT"
if [[ ! -f "Cargo.toml" ]]; then
echo "error: Cargo.toml not found in $REPO_ROOT"
echo "hint: move this script to the repo root, or adjust REPO_ROOT to point to it."
exit 1
fi
echo "==> Repo root: $REPO_ROOT"
echo "==> Rust toolchain"
rustc -Vv
cargo -V
cargo clippy -V
if [[ "$SANDBOX_MODE" -eq 1 ]]; then
echo
echo "==> Sandbox mode enabled"
echo "This gate is deterministic and avoids network/temp-dependent checks."
fi
echo
echo "==> Formatting (cargo fmt --check)"
cargo fmt --all -- --check
echo
echo "==> Clippy (deny warnings)"
cargo clippy --workspace --all-targets --all-features -- -D warnings
echo
echo "==> Tests (deny rustc warnings via RUSTFLAGS)"
if [[ "$SANDBOX_MODE" -eq 1 ]]; then
RUSTFLAGS="-D warnings" cargo test --workspace
else
RUSTFLAGS="-D warnings" cargo test --workspace --features network-tests
fi
if [[ "$ALLOW_TEMP_CHECKS" -eq 1 ]]; then
echo
echo "==> Man pages (check drift against source)"
bash scripts/check_manpages.sh
else
echo
echo "==> SKIP: Man page check (requires writable temp directory)"
fi
if [[ "$SANDBOX_MODE" -eq 1 && "$ALLOW_TEMP_CHECKS" -eq 0 ]]; then
echo
echo "==> Sandbox skip report"
echo "SKIP: VS Code E2E/loopback gates (depends on local TCP loopback availability)."
echo "SKIP: Temp-dir constrained scenarios (depends on writable system temp directories)."
echo "Result: ci-sandbox completed successfully."
exit 0
fi
if [[ "$SANDBOX_MODE" -eq 0 ]]; then
echo
echo "======================================="
echo "✅ All local CI gates passed successfully!"
echo "======================================="
exit 0
fi