-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcheck-ci.sh
More file actions
executable file
·133 lines (118 loc) · 3.79 KB
/
check-ci.sh
File metadata and controls
executable file
·133 lines (118 loc) · 3.79 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
# Quick CI check script - run before pushing to ensure CI will pass
set -e # Exit on first error
echo ""
echo "KEYLESS CI CHECK"
echo "────────────────────────────────────────────────"
echo ""
# Step 1: Format
printf "[1/11] Format check... "
if cargo fmt --all -- --check > /dev/null 2>&1; then
echo "✓"
else
echo "✗"
echo " Fix with: cargo fmt --all"
exit 1
fi
# Step 2: Clippy
printf "[2/11] Clippy (strict)... "
if cargo clippy --all-targets -- -D warnings -D clippy::unwrap_used -D clippy::expect_used > /tmp/clippy.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/clippy.log | grep error"
exit 1
fi
# Step 3: Build
printf "[3/11] Build (all targets)... "
if cargo build --workspace --all-targets > /tmp/build.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/build.log | grep error"
exit 1
fi
# Step 4: Test
printf "[4/11] Tests (workspace)... "
if cargo test --workspace --no-fail-fast > /tmp/test.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/test.log | grep FAILED"
exit 1
fi
# Step 5: Docs build (warnings as errors)
printf "[5/11] Docs build... "
if RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps > /tmp/docs.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/docs.log | grep error"
exit 1
fi
# Step 6: Doctests
printf "[6/11] Doctests... "
if cargo test --workspace --doc > /tmp/doctest.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/doctest.log | grep FAILED"
exit 1
fi
# Step 7: Clippy doc lints on private items
printf "[7/11] Clippy (docs private)... "
if cargo clippy --workspace -- -D clippy::missing_docs_in_private_items > /tmp/clippy_docs.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/clippy_docs.log | grep error"
exit 1
fi
# Step 8: Frontend typecheck (TS)
printf "[8/11] Frontend typecheck... "
if pnpm -C keyless-desktop install --frozen-lockfile > /tmp/frontend_install.log 2>&1 && pnpm -C keyless-desktop exec tsc --noEmit > /tmp/frontend_typecheck.log 2>&1; then
echo "✓"
else
echo "✗"
echo " Install log: sed -n '1,80p' /tmp/frontend_install.log"
echo " See errors: sed -n '1,200p' /tmp/frontend_typecheck.log"
exit 1
fi
# Step 9: Frontend tests (Vitest)
printf "[9/11] Frontend tests... "
if pnpm -C keyless-desktop test > /tmp/frontend_test.log 2>&1; then
echo "✓"
else
# Check if the failure is due to no test files found (which is acceptable)
if grep -q "No test files found" /tmp/frontend_test.log; then
echo "✓ (no tests)"
else
echo "✗"
echo " See errors: sed -n '1,200p' /tmp/frontend_test.log"
exit 1
fi
fi
# Step 10: Cargo deny (security advisories, licenses, duplicates)
printf "[10/11] Cargo deny check... "
if cargo deny check > /tmp/cargo_deny.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/cargo_deny.log"
echo " Install with: cargo install cargo-deny --locked"
exit 1
fi
# Step 11: Cargo audit (RustSec vulnerability database)
printf "[11/11] Cargo audit... "
if cargo audit > /tmp/cargo_audit.log 2>&1; then
echo "✓"
else
echo "✗"
echo " See errors: cat /tmp/cargo_audit.log"
echo " Install with: cargo install cargo-audit --locked"
exit 1
fi
echo ""
echo "────────────────────────────────────────────────"
echo "All checks passed - ready to push"
echo ""