Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/windows-scoped-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ jobs:
needs: windows-scope
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.files != '') || needs.windows-scope.outputs.files != '' }}
runs-on: windows-latest
timeout-minutes: 20
# Large selections get 15 minutes per runner phase (parallel, optional
# exclusive, existing serial retry), plus five minutes for setup/logs.
timeout-minutes: 50
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
Expand Down Expand Up @@ -193,7 +195,14 @@ jobs:
run: |
set -euo pipefail
printf '%s\n' "$FILES" | tr -d '\r' | tr ' ' '\n' | sed '/^$/d' > "$RUNNER_TEMP/windows-scoped-files.txt"
bun run scripts/test-free-shards.ts --files-from "$RUNNER_TEMP/windows-scoped-files.txt"
# More than 72 files exceeds the runner's six-minute floor at its
# five-seconds-per-file heuristic. The 113-file sync timed out all
# four shards at that floor. Keep ordinary scopes on runner defaults.
extra_args=()
if [ "$(wc -l < "$RUNNER_TEMP/windows-scoped-files.txt")" -gt 72 ]; then
extra_args=(--wall-timeout 900)
fi
bun run scripts/test-free-shards.ts --files-from "$RUNNER_TEMP/windows-scoped-files.txt" "${extra_args[@]}"
shell: bash

- name: Upload full test logs
Expand Down
25 changes: 25 additions & 0 deletions test/windows-path-scope-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,31 @@ describe('the path-scoped Windows shard on pull requests', () => {
expect(lanes.map(l => [l.job, l.manual])).toEqual([['windows-scoped-shard', true]]);
});

test.skipIf(!Bun.which('bash'))('large scoped selections get a bounded deadline without losing files or swallowing failures', () => {
const shard = scoped.jobs['windows-scoped-shard'];
const run = shard.steps.find((s: any) => s.name === 'Run the scoped Windows-safe test files');
const temp = newTemp();
const bin = path.join(temp, 'bin');
fs.mkdirSync(bin);
// Exercise the actual workflow script, capturing what it hands the runner.
fs.writeFileSync(path.join(bin, 'bun'), '#!/bin/bash\nprintf "%s\\n" "$@" > "$RUNNER_TEMP/args"\nexit "${STUB_EXIT:-0}"\n', { mode: 0o755 });
for (const [count, separator, failure] of [[1, ' ', 0], [72, '\n', 0], [73, ' ', 0], [113, '\r\n', 0], [113, ' ', 124], [1, '\n', 1]] as const) {
const files = Array.from({ length: count }, (_, i) => `test/scope-${i}.test.ts`);
const result = runStep(run.run, ROOT, {
PATH: `${toShell(bin)}:${process.env.PATH}`, FILES: files.join(separator), STUB_EXIT: String(failure),
}, temp);
expect(result.status, result.stderr).toBe(failure);
expect(fs.readFileSync(path.join(temp, 'windows-scoped-files.txt'), 'utf8').trim().split('\n')).toEqual(files);
const args = fs.readFileSync(path.join(temp, 'args'), 'utf8').trim().split('\n');
expect(args.slice(0, 4)).toEqual(['run', 'scripts/test-free-shards.ts', '--files-from', `${toShell(temp)}/windows-scoped-files.txt`]);
expect(args.slice(4)).toEqual(count > 72 ? ['--wall-timeout', '900'] : []);
}
// Parallel phase, optional exclusive phase, then the existing serial retry
// each inherit the explicit wall. Allow five minutes for setup and logs.
expect(shard['timeout-minutes']).toBeGreaterThanOrEqual((3 * 900) / 60 + 5);
expect(shard['timeout-minutes']).toBeLessThanOrEqual(50);
});

test("#3758's and #3829's failing test files are in the curated Windows-safe subset", () => {
const { safe } = curateWindowsSafe(collectFreeTestFiles(ROOT), ROOT);
expect(safe).toContain('test/hook-scripts.test.ts');
Expand Down
Loading