diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 643ce30d677..b5c9d3ce0dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -523,10 +523,19 @@ jobs: VITEST_MIN_THREADS: "${{ startsWith(runner.name, 'ecs-qwen-') && '1' || '' }}" VITEST_MAX_FORKS: "${{ startsWith(runner.name, 'ecs-qwen-') && (vars.QWEN_CI_VITEST_MAX_WORKERS || '4') || '' }}" VITEST_MIN_FORKS: "${{ startsWith(runner.name, 'ecs-qwen-') && '1' || '' }}" - # Nightly and preview releases may absorb a transient timing failure; - # stable releases remain strict and never retry a failed test. - VITEST_RETRY: "${{ (needs.prepare.outputs.is_nightly == 'true' || needs.prepare.outputs.is_preview == 'true') && '2' || '0' }}" - run: 'npm run test:release:workspaces -- --shard=${{ matrix.shard }}/3 --passWithNoTests --retry="${VITEST_RETRY}"' + # Nightly and preview releases may absorb a transient timing + # failure. Stable releases add no retry of their own and stay on + # whatever each workspace's Vitest config asks for; the flag is + # omitted rather than set to 0, because a command-line --retry=0 + # outranks the config and would disable a workspace's deliberate + # retry (packages/sdk-typescript) on the release lane alone. + VITEST_RETRY: "${{ (needs.prepare.outputs.is_nightly == 'true' || needs.prepare.outputs.is_preview == 'true') && '2' || '' }}" + run: |- + retry_arg=() + if [ -n "${VITEST_RETRY}" ]; then + retry_arg=("--retry=${VITEST_RETRY}") + fi + npm run test:release:workspaces -- --shard=${{ matrix.shard }}/3 --passWithNoTests "${retry_arg[@]}" quality_scripts: name: 'Quality Checks (Scripts)' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 004f6847bfb..1aa816c4a14 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,8 +1,8 @@ name: 'Mark stale issues and pull requests' # Run as a daily cron at 00:30 UTC (Beijing time 08:30). -# Avoid the top of the hour to dodge GitHub's high-contention window, -# and stay 30 minutes after release.yml (00:00 UTC) to reduce overlap. +# Avoid the top of the hour to dodge GitHub's high-contention window. +# This no longer trails the nightly release, which moved to 21:00 UTC. on: schedule: - cron: '30 0 * * *' diff --git a/scripts/tests/release-workflow.test.js b/scripts/tests/release-workflow.test.js index b1085dd6d71..00e8e407223 100644 --- a/scripts/tests/release-workflow.test.js +++ b/scripts/tests/release-workflow.test.js @@ -537,11 +537,11 @@ describe('release workflow', () => { const testStep = job.steps.find( (step) => step.name === 'Run Workspace Tests', ); - expect(testStep.run).toBe( - 'npm run test:release:workspaces -- --shard=${{ matrix.shard }}/3 --passWithNoTests --retry="${VITEST_RETRY}"', + expect(testStep.run).toContain( + 'npm run test:release:workspaces -- --shard=${{ matrix.shard }}/3 --passWithNoTests "${retry_arg[@]}"', ); expect(testStep.env.VITEST_RETRY).toBe( - "${{ (needs.prepare.outputs.is_nightly == 'true' || needs.prepare.outputs.is_preview == 'true') && '2' || '0' }}", + "${{ (needs.prepare.outputs.is_nightly == 'true' || needs.prepare.outputs.is_preview == 'true') && '2' || '' }}", ); const workspacePackages = getTestCiWorkspaces(); @@ -559,6 +559,59 @@ describe('release workflow', () => { } }); + it('passes --retry only when the release schedule asks for one', () => { + // The flag reaches every workspace's vitest, where a command line option + // outranks the config. Passing --retry=0 on stable releases would switch + // off a workspace's own retry (packages/sdk-typescript) on this lane + // alone, so the stable path must omit the flag rather than zero it. + const testStep = releaseYaml.jobs.workspace_tests.steps.find( + (step) => step.name === 'Run Workspace Tests', + ); + const script = testStep.run.replaceAll('${{ matrix.shard }}', '1'); + + for (const [retry, expected] of [ + ['2', '--retry=2'], + ['', null], + ]) { + const dir = mkdtempSync(join(tmpdir(), 'release-retry-')); + try { + const stub = join(dir, 'npm'); + writeFileSync(stub, '#!/bin/sh\nprintf "%s\\0" "$@"\n'); + chmodSync(stub, 0o755); + + const result = spawnSync( + 'bash', + ['-e', '-o', 'pipefail', '-c', script], + { + env: { + ...process.env, + PATH: `${dir}:${process.env['PATH']}`, + VITEST_RETRY: retry, + }, + encoding: 'utf8', + }, + ); + + expect(result.status, result.stderr).toBe(0); + const args = result.stdout.split('\0'); + expect(args.pop()).toBe(''); + expect(args, retry).toContain('--passWithNoTests'); + // An empty positional would reach vitest as a test-name filter. + expect(args, retry).not.toContain(''); + if (expected) { + expect(args, retry).toContain(expected); + } else { + expect( + args.some((arg) => arg.startsWith('--retry')), + retry, + ).toBe(false); + } + } finally { + rmSync(dir, { recursive: true, force: true }); + } + } + }); + it('discovers at least one test file in every test:ci workspace', () => { // --passWithNoTests lets a shard that received no files exit 0, but it // would also turn a workspace that lost every test file green in all