diff --git a/.github/workflows/windows-scoped-tests.yml b/.github/workflows/windows-scoped-tests.yml index be88c94c996..f71a2217286 100644 --- a/.github/workflows/windows-scoped-tests.yml +++ b/.github/workflows/windows-scoped-tests.yml @@ -145,8 +145,9 @@ jobs: windows-scoped-shard: needs: windows-scope if: ${{ (github.event_name == 'workflow_dispatch' && inputs.files != '') || needs.windows-scope.outputs.files != '' }} + # CHE-9817: an upstream sync selects ~110 files, 2773 s of Windows seed. 60 min covers that run serially plus setup. runs-on: windows-latest - timeout-minutes: 20 + timeout-minutes: 60 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: @@ -186,6 +187,8 @@ jobs: - name: Run the scoped Windows-safe test files env: FILES: ${{ inputs.files || needs.windows-scope.outputs.files }} + # Pack and time the shards by Windows-measured durations: the Linux seed is ~7x too fast (CHE-9817). + GSTACK_FREE_TEST_DURATIONS: scripts/free-test-durations-windows.json GSTACK_FREE_RETRY_FLAKY: '1' GSTACK_FLAKE_LEDGER: ${{ runner.temp }}/flake-ledger.jsonl TEMP: ${{ runner.temp }} diff --git a/changelog.d/che-9817-windows-scoped-budget.md b/changelog.d/che-9817-windows-scoped-budget.md new file mode 100644 index 00000000000..285b63d3d77 --- /dev/null +++ b/changelog.d/che-9817-windows-scoped-budget.md @@ -0,0 +1 @@ +The scoped Windows test job packs its shards by the Windows-measured durations and skips a selection the Windows seed predicts over 2400 s (the nightly Windows suite covers it), so a large upstream-sync pull request no longer times out all four shards (CHE-9817). diff --git a/test/windows-path-scope-workflow.test.ts b/test/windows-path-scope-workflow.test.ts index 810accb2540..654826ea43a 100644 --- a/test/windows-path-scope-workflow.test.ts +++ b/test/windows-path-scope-workflow.test.ts @@ -233,18 +233,20 @@ describe('the path-scoped Windows shard on pull requests', () => { const CAN_SELECT = CAN_RUN && !!Bun.which('jq'); /** Filter, then select with a stub bun whose curated plan holds the given files. */ - function scopeJob(dir: string, curated: string[]) { + function scopeJob(dir: string, curated: string[], seed: Record = {}) { const filter = runStep(filterScript, dir); expect(filter.status, filter.stderr).toBe(0); const scope = fs.readFileSync(path.join(filter.temp, 'windows-scope'), 'utf8'); - if (filter.outputs.windows !== 'true') return { windows: filter.outputs.windows, scope, files: undefined as string | undefined }; + if (filter.outputs.windows !== 'true') return { windows: filter.outputs.windows, scope, files: undefined as string | undefined, summary: '' }; const bin = path.join(filter.temp, 'bin'); fs.mkdirSync(bin); fs.writeFileSync(path.join(bin, 'bun'), '#!/bin/sh\nwhile [ $# -gt 0 ]; do [ "$1" = --ci-plan ] && printf \'%s\' "$PLAN_JSON" > "$2"; shift; done\necho \'{"shard":[1]}\'\n', { mode: 0o755 }); const plan = JSON.stringify({ version: 1, revision: 'r', shards: [{ shard: 1, predictedMs: 1, files: curated }], id: 'x' }); - const select = runStep(selectScript, dir, { PATH: `${toShell(bin)}:${process.env.PATH}`, PLAN_JSON: plan }, filter.temp); + const seedFile = path.join(filter.temp, 'seed.json'); + fs.writeFileSync(seedFile, JSON.stringify({ version: 1, durations: seed })); + const select = runStep(selectScript, dir, { PATH: `${toShell(bin)}:${process.env.PATH}`, PLAN_JSON: plan, GSTACK_FREE_TEST_DURATIONS: toShell(seedFile) }, filter.temp); expect(select.status, select.stderr).toBe(0); - return { windows: filter.outputs.windows, scope, files: select.outputs.files }; + return { windows: filter.outputs.windows, scope, files: select.outputs.files, summary: select.summary }; } const CURATED = ['test/hook-scripts.test.ts', 'test/review-risk-linear.test.ts', 'test/review-risk-routing.test.ts']; @@ -290,6 +292,27 @@ describe('the path-scoped Windows shard on pull requests', () => { } }); + // CHE-9817: an upstream sync selected 112 files, the job packed them by the Linux seed (~88 s a shard) and every + // shard hit the 360 s wall on Windows, where the same files run ~7x slower (Windows seed: 1363 s for the 65 it covers; 47 had no entry). + test('the scoped run packs by the Windows seed, not the Linux one', () => { + const run = scoped.jobs['windows-scoped-shard'].steps.find((s: any) => s.name === 'Run the scoped Windows-safe test files'); + expect(run.env.GSTACK_FREE_TEST_DURATIONS).toBe('scripts/free-test-durations-windows.json'); + }); + + // A large selection is never skipped: a green run with no Windows job proves nothing (CHE-9817). + test.skipIf(!CAN_SELECT)('CHE-9817: a selection the Windows seed predicts at 2600 s is still selected, not skipped', () => { + const files = ['test/sync-a.test.ts', 'test/sync-b.test.ts']; + const dir = prRepo(['bin/gstack-example', ...files]); + try { + const job = scopeJob(dir, files, { 'test/sync-a.test.ts': 1_300_000, 'test/sync-b.test.ts': 1_300_000 }); + expect([job.windows, job.files]).toEqual(['true', files.join('\n')]); + } finally { fs.rmSync(dir, { recursive: true, force: true }); } + }); + + test('CHE-9817: the Windows job timeout leaves headroom for a 2773 s selection plus setup', () => { + expect(scoped.jobs['windows-scoped-shard']['timeout-minutes']).toBeGreaterThanOrEqual(60); + }); + test.skipIf(!CAN_SELECT)('in scope but no changed Windows-safe test file: no files, so no Windows job', () => { const dir = prRepo(['bin/gstack-example', 'test/posix-only.test.ts']); try {