Skip to content

Commit 28839df

Browse files
committed
ci: reduce Windows unit-test cold starts
1 parent 9973630 commit 28839df

3 files changed

Lines changed: 79 additions & 7 deletions

File tree

‎.github/workflows/code-qa.yml‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ jobs:
9090
run: pnpm lint
9191
- name: Check types
9292
run: pnpm check-types
93+
- name: Validate Code QA workflow
94+
run: pnpm test:code-qa-ci
9395
- name: Model-check task lifecycle protocols
9496
run: pnpm lifecycle:model-check
9597
- name: Validate MCP OAuth integration
@@ -135,11 +137,11 @@ jobs:
135137
- os: ubuntu-latest
136138
name: ubuntu-latest
137139
codecov-flag: ubuntu
138-
upload-coverage: true
140+
collect-coverage: true
139141
- os: windows-latest
140142
name: windows-latest
141143
codecov-flag: windows
142-
upload-coverage: false
144+
collect-coverage: false
143145
steps:
144146
- name: Checkout code
145147
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -155,31 +157,51 @@ jobs:
155157
${{ runner.os }}-turbo-${{ hashFiles('**/pnpm-lock.yaml') }}-
156158
${{ runner.os }}-turbo-
157159
- name: Run non-extension package coverage
160+
if: matrix.collect-coverage
158161
run: pnpm turbo run test:coverage --filter="!@roo-code/core" --filter="!zoo-code" --log-order grouped --output-logs new-only
162+
- name: Run non-extension package tests
163+
if: ${{ !matrix.collect-coverage }}
164+
run: pnpm turbo run test --filter="!@roo-code/core" --filter="!zoo-code" --log-order grouped --output-logs new-only
159165
- name: Run extension coverage lanes
166+
if: matrix.collect-coverage
160167
run: pnpm turbo run test:coverage:api test:coverage:core test:coverage:services test:coverage:misc test:coverage:tree-sitter --filter="zoo-code" --concurrency=2 --log-order grouped --output-logs new-only
168+
- name: Run extension unit tests
169+
if: ${{ !matrix.collect-coverage }}
170+
run: pnpm turbo run test:unit --filter="zoo-code" --log-order grouped --output-logs new-only
161171
- name: Verify extension coverage contract
172+
if: matrix.collect-coverage
162173
run: pnpm --dir src run verify:coverage-contract
163174
- name: Run extension dist smoke test
164175
run: pnpm turbo run test:dist --filter="zoo-code" --log-order grouped --output-logs new-only
165176
- name: Run core unit coverage
177+
if: matrix.collect-coverage
166178
run: pnpm turbo run test:coverage:unit --filter="@roo-code/core" --log-order grouped --output-logs new-only
179+
- name: Run core unit tests
180+
if: ${{ !matrix.collect-coverage }}
181+
run: pnpm turbo run test:unit --filter="@roo-code/core" --log-order grouped --output-logs new-only
167182
- name: Run core integration coverage
183+
if: matrix.collect-coverage
168184
run: pnpm turbo run test:coverage:integration --filter="@roo-code/core" --log-order grouped --output-logs new-only
185+
- name: Run core integration tests
186+
if: ${{ !matrix.collect-coverage }}
187+
run: pnpm turbo run test:integration --filter="@roo-code/core" --log-order grouped --output-logs new-only
169188
- name: Verify extension coverage reports
189+
if: matrix.collect-coverage
170190
run: |
171191
node src/scripts/verify-lcov.mjs src/coverage/api/lcov.info
172192
node src/scripts/verify-lcov.mjs src/coverage/core/lcov.info
173193
node src/scripts/verify-lcov.mjs src/coverage/services/lcov.info
174194
node src/scripts/verify-lcov.mjs src/coverage/misc/lcov.info
175195
node src/scripts/verify-lcov.mjs src/coverage/tree-sitter/lcov.info
176196
- name: Merge extension coverage reports
197+
if: matrix.collect-coverage
177198
run: |
178199
mkdir -p src/coverage/merged
179200
pnpm --dir src run merge:coverage
180201
node src/scripts/verify-lcov.mjs src/coverage/merged/lcov.info
181202
# Validate cache boundaries before publishing any new Turbo entries.
182203
- name: Verify coverage cache inputs
204+
if: matrix.collect-coverage
183205
run: pnpm --dir src run verify:coverage-cache-inputs
184206
- name: Save Turbo cache
185207
if: steps.turbo-cache.outputs.cache-hit != 'true'
@@ -197,7 +219,7 @@ jobs:
197219
# it. Core and webview reports retain their independent flags.
198220
# See https://docs.codecov.com/docs/flags
199221
- name: Upload non-core coverage to Codecov
200-
if: matrix.upload-coverage
222+
if: matrix.collect-coverage
201223
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
202224
with:
203225
files: >-
@@ -209,31 +231,31 @@ jobs:
209231
flags: ${{ matrix.codecov-flag }}
210232
token: ${{ secrets.CODECOV_TOKEN }}
211233
- name: Upload webview JSDOM coverage to Codecov
212-
if: matrix.upload-coverage
234+
if: matrix.collect-coverage
213235
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
214236
with:
215237
files: webview-ui/coverage/lcov.info
216238
disable_search: true
217239
flags: webview-ui
218240
token: ${{ secrets.CODECOV_TOKEN }}
219241
- name: Upload core unit coverage to Codecov
220-
if: matrix.upload-coverage
242+
if: matrix.collect-coverage
221243
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
222244
with:
223245
files: packages/core/coverage/unit/lcov.info
224246
disable_search: true
225247
flags: ${{ matrix.codecov-flag }},core-unit
226248
token: ${{ secrets.CODECOV_TOKEN }}
227249
- name: Upload core integration coverage to Codecov
228-
if: matrix.upload-coverage
250+
if: matrix.collect-coverage
229251
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
230252
with:
231253
files: packages/core/coverage/integration/lcov.info
232254
disable_search: true
233255
flags: ${{ matrix.codecov-flag }},core-integration
234256
token: ${{ secrets.CODECOV_TOKEN }}
235257
- name: Upload coverage reports to GitHub
236-
if: matrix.upload-coverage
258+
if: matrix.collect-coverage
237259
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
238260
with:
239261
name: coverage-reports-${{ matrix.name }}

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint": "turbo lint --log-order grouped --output-logs new-only",
1313
"check-types": "turbo check-types --log-order grouped --output-logs new-only",
1414
"test": "turbo test --log-order grouped --output-logs new-only",
15+
"test:code-qa-ci": "node --test scripts/code-qa-workflow.test.mjs",
1516
"test:mutation-ci": "node --test scripts/stryker-diff.test.mjs",
1617
"lifecycle:model-check": "tsx scripts/check-task-lifecycle.ts && tsx scripts/check-task-store-concurrency.ts && tsx scripts/check-provider-handoff-scheduler.ts && pnpm cleanup-protocol:model-check && pnpm parser-scope:model-check && tsx scripts/check-completion-persistence.ts && tsx scripts/check-delegated-mode-readers.ts",
1718
"cleanup-protocol:model-check": "tsx scripts/check-task-cleanup-protocol.ts",

‎scripts/code-qa-workflow.test.mjs‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import assert from "node:assert/strict"
2+
import fs from "node:fs"
3+
import path from "node:path"
4+
import { describe, it } from "node:test"
5+
import { fileURLToPath } from "node:url"
6+
7+
const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..")
8+
const workflow = fs.readFileSync(path.join(repositoryRoot, ".github/workflows/code-qa.yml"), "utf8")
9+
10+
const workflowStep = (name) => {
11+
const match = workflow.match(new RegExp(`- name: ${name}\\n(?<body>(?:\\s{14,}.*\\n?)*)`))
12+
assert.ok(match?.groups?.body, `missing workflow step: ${name}`)
13+
return match.groups.body
14+
}
15+
16+
describe("platform unit-test workflow", () => {
17+
it("keeps coverage authoritative on Ubuntu and runs equivalent uninstrumented Windows tests", () => {
18+
assert.match(workflow, /name: ubuntu-latest[\s\S]*?collect-coverage: true/)
19+
assert.match(workflow, /name: windows-latest[\s\S]*?collect-coverage: false/)
20+
21+
for (const lane of ["api", "core", "services", "misc", "tree-sitter"]) {
22+
assert.ok(workflow.includes(`test:coverage:${lane}`), `missing ${lane} coverage lane`)
23+
}
24+
25+
assert.ok(workflow.includes('test:coverage --filter="!@roo-code/core" --filter="!zoo-code"'))
26+
assert.ok(workflow.includes('test --filter="!@roo-code/core" --filter="!zoo-code"'))
27+
assert.ok(workflow.includes('test:unit --filter="zoo-code"'))
28+
assert.ok(workflow.includes('test:coverage:unit --filter="@roo-code/core"'))
29+
assert.ok(workflow.includes('test:unit --filter="@roo-code/core"'))
30+
assert.ok(workflow.includes('test:coverage:integration --filter="@roo-code/core"'))
31+
assert.ok(workflow.includes('test:integration --filter="@roo-code/core"'))
32+
})
33+
34+
it("does not run coverage verification or uploads on Windows", () => {
35+
for (const stepName of [
36+
"Verify extension coverage contract",
37+
"Verify extension coverage reports",
38+
"Merge extension coverage reports",
39+
"Verify coverage cache inputs",
40+
"Upload non-core coverage to Codecov",
41+
"Upload webview JSDOM coverage to Codecov",
42+
"Upload core unit coverage to Codecov",
43+
"Upload core integration coverage to Codecov",
44+
"Upload coverage reports to GitHub",
45+
]) {
46+
assert.match(workflowStep(stepName), /if: matrix\.collect-coverage/)
47+
}
48+
})
49+
})

0 commit comments

Comments
 (0)