-
Notifications
You must be signed in to change notification settings - Fork 2
196 lines (171 loc) · 5.3 KB
/
Copy pathci.yml
File metadata and controls
196 lines (171 loc) · 5.3 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Lint, Format & Test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Check formatting
run: npm run format:check
- name: Run tests
run: npm test -- --reporter=verbose
- name: Build performance tracking
run: |
START=$(date +%s%N)
npm run validate > /dev/null 2>&1
END=$(date +%s%N)
ELAPSED=$(( (END - START) / 1000000 ))
echo "validate_duration_ms=$ELAPSED" >> $GITHUB_ENV
echo "Full validation completed in ${ELAPSED}ms"
if [ "$ELAPSED" -gt 30000 ]; then
echo "::warning::Validation took ${ELAPSED}ms (>30s threshold)"
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results/
retention-days: 14
link-check:
name: Check Markdown Links
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- uses: lycheeverse/lychee-action@v2
with:
args: --no-progress --max-concurrency 16 "*.md" "docs/**/*.md" ".github/**/*.md"
fail: true
tech-debt-scan:
name: TODO/FIXME Scanner
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: Scan for TODOs without issue references
run: |
echo "Scanning for untracked TODOs..."
FOUND=$(grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.md" . \
--exclude-dir=".git" \
--exclude-dir="node_modules" \
| grep -v "TODO(#" \
| grep -v "TODO(TICKET" \
| grep -v "AGENTS.md" \
|| true)
if [ -n "$FOUND" ]; then
echo "WARNING: Found TODOs without issue references:"
echo "$FOUND"
else
echo "No untracked TODOs found."
fi
file-size-check:
name: Large File Detection
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- name: Check for large files
run: |
MAX_SIZE=51200 # 50KB
FOUND=0
while IFS= read -r file; do
SIZE=$(wc -c < "$file" 2>/dev/null || echo 0)
if [ "$SIZE" -gt "$MAX_SIZE" ]; then
echo "WARNING: $file is $SIZE bytes (max: $MAX_SIZE)"
FOUND=1
fi
done < <(find . -type f \
-not -path './.git/*' \
-not -path './node_modules/*' \
-not -path './.git')
if [ "$FOUND" -eq 1 ]; then
echo "Large files detected. Consider splitting or using Git LFS."
else
echo "All files within size limits."
fi
flaky-test-detection:
name: Flaky Test Detection
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests 3x with shuffle to detect flakiness
run: |
PASS=0
FAIL=0
for i in 1 2 3; do
echo "=== Run $i ==="
if npx vitest run --sequence.shuffle 2>&1; then
PASS=$((PASS + 1))
else
FAIL=$((FAIL + 1))
fi
done
echo "Passes: $PASS / 3, Failures: $FAIL / 3"
if [ "$FAIL" -gt 0 ]; then
echo "::error::$FAIL out of 3 runs failed. Tests may be flaky."
exit 1
fi
echo "All 3 runs passed. No flakiness detected."
docs-validation:
name: AGENTS.md Consistency Check
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: Verify AGENTS.md exists and is non-empty
run: |
if [ ! -f AGENTS.md ]; then
echo "ERROR: AGENTS.md not found"
exit 1
fi
LINES=$(wc -l < AGENTS.md)
if [ "$LINES" -lt 100 ]; then
echo "ERROR: AGENTS.md is only $LINES lines (minimum: 100)"
exit 1
fi
echo "AGENTS.md: $LINES lines - OK"
- name: Verify harness adapters reference master spec
run: |
for f in CLAUDE.md CODEX.md GEMINI.md .cursorrules .factory/AGENTS.md; do
if [ -f "$f" ]; then
if grep -q "AGENTS.md" "$f"; then
echo "$f references AGENTS.md - OK"
else
echo "WARNING: $f does not reference AGENTS.md"
fi
fi
done
- name: Verify build commands in README
run: |
if ! grep -q "npm test\|npm run" README.md 2>/dev/null; then
echo "WARNING: README.md does not document test/build commands"
else
echo "README.md documents build commands - OK"
fi