Repository navigation
165 lines (153 loc) · 5.63 KB
/
Copy pathci.yml
File metadata and controls
165 lines (153 loc) · 5.63 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run typecheck
lint:
name: Lint + Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run format:check
test:
name: Tests (${{ matrix.os }} / Node ${{ matrix.node }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['18', '20', '22']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python3 -m pip install pytest requests coverage
- run: npm ci
# help-drift.test.ts asserts against dist/ and now HARD FAILS when it is
# absent. Without this build it skipped in all nine matrix jobs at exit 0.
- run: npm run build
- run: npm test -- --coverage
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
# The `test` matrix installs the latest pytest, so rows gated on an older one
# never run there.
pytest-8:
name: pytest config (pytest 8)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python3 -m pip install 'pytest<9' coverage
- run: npm ci
- run: >-
npx vitest run
tests/unit/verify/pytest-config-sidecar.test.ts
tests/unit/verify/pytest-config.test.ts
tests/integration/pytest-config-narrowing.test.ts
product-gate:
name: Product Gate
runs-on: ubuntu-latest
needs: [typecheck, lint, test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python3 -m pip install pytest requests coverage
- run: npm ci
- run: npm run build
# Deliberately NOT `verify-diff` against this repo. Coverage attestation
# is Python-only (verdict-fuse types the tool as 'coverage.py' | 'none'),
# so a TypeScript repo verifying its own diff caps at UNPROVEN forever:
# it would either fail every PR or assert only what `test` already proves.
# This gates the shipped artifact instead.
- name: The binary runs
run: |
node dist/cli/index.js --version
node dist/cli/index.js --help | grep -q 'verify-diff'
node dist/cli/index.js --help | grep -q 'login'
! node dist/cli/index.js --help | grep -qE '^\s+(analyze|run|document|preflight|init)\b'
- name: A departed command is rejected, not a missing module
run: |
out=$(node dist/cli/index.js analyze 2>&1) && exit 1
echo "$out" | grep -q 'removed in 0.4.0'
echo "$out" | grep -q 'refactron@0.3.1'
! echo "$out" | grep -q 'ERR_MODULE_NOT_FOUND'
# Criterion 4: bare invocation. Asserted nowhere in CI before.
node dist/cli/index.js >/dev/null 2>&1 && exit 1
[ $? -eq 2 ]
- name: Python sidecars reached dist
run: |
test -f dist/verify/checks/_py/syntax_check.py
test -f dist/verify/checks/_py/imports_check.py
test -f dist/verify/checks/_py/statement_map.py
- name: The MCP server exposes verify_change
run: |
printf '%s\n%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
| timeout 30 node dist/mcp/server.js | grep -q 'verify_change'
- name: The tarball carries the sidecars and no transform code
run: |
npm pack --dry-run --json > /tmp/pack.json
node -e "
const f=require('/tmp/pack.json')[0].files.map(x=>x.path);
const need=['dist/verify/checks/_py/syntax_check.py','dist/verify/checks/_py/imports_check.py','dist/verify/checks/_py/statement_map.py','dist/index.js','dist/cli/index.js','dist/mcp/server.js'];
const missing=need.filter(n=>!f.includes(n));
if(missing.length){console.error('missing from tarball: '+missing.join(', '));process.exit(1)}
const leaked=f.filter(x=>x.startsWith('dist/transform/')||x.startsWith('dist/autofix/'));
if(leaked.length){console.error('refactoring code leaked into tarball: '+leaked.join(', '));process.exit(1)}
console.log('tarball ok: '+f.length+' files');
"
build:
name: Build Check
runs-on: ubuntu-latest
needs: [typecheck]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7