ci: split the layout oracle window scenarios across two shards (#34671)

The single-file oracle cannot be split by whole-file balancing, so pass
Playwright test-level shards to the changed-spec lane. It was the last
required check in 40 of 42 measured runs.

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-10-27 19:25:17 -07:00
committed by GitHub
co-authored by OrcaWin
parent e1838023cc
commit 4cd62c4946
2 changed files with 18 additions and 1 deletions
+16 -1
View File
@@ -32,6 +32,12 @@ on:
required: false
type: string
default: '["1/2","2/2"]'
# Why: whole-file balancing cannot split one long spec; Playwright's native shards split its tests.
changed_e2e_test_shards:
description: JSON test-level shard assignments for the changed-spec lane; empty sizes shards by file count
required: false
type: string
default: ''
# Why: artifact names are unique per workflow run, and pr.yml calls this workflow twice.
artifact_suffix:
description: Appended to the build and trace artifact names so two calls in one run do not collide
@@ -85,7 +91,12 @@ jobs:
id: changed-e2e-shards
env:
TEST_FILES_JSON: ${{ inputs.test_files }}
TEST_SHARDS_JSON: ${{ inputs.changed_e2e_test_shards }}
run: |
if [ -n "$TEST_SHARDS_JSON" ]; then
echo "shards=$(jq -c . <<<"$TEST_SHARDS_JSON")" >> "$GITHUB_OUTPUT"
exit 0
fi
node --input-type=module <<'NODE'
import { appendFileSync, existsSync } from 'node:fs'
const modulePath = './config/scripts/ci-e2e-job-selection.mjs'
@@ -361,6 +372,7 @@ jobs:
TEST_FILES_JSON: ${{ inputs.test_files }}
LAYOUT_OWNER: ${{ inputs.layout_owner }}
SHARD: ${{ matrix.shard }}
TEST_LEVEL_SHARDS: ${{ inputs.changed_e2e_test_shards != '' }}
run: |
if [ -f config/scripts/ci-e2e-job-selection.mjs ]; then
printf '%s\n' "$TEST_FILES_JSON" | node config/scripts/ci-e2e-job-selection.mjs > "$RUNNER_TEMP/general-e2e-specs"
@@ -397,7 +409,10 @@ jobs:
E2E_PROJECT_ARGS+=(--project=electron-headful)
fi
E2E_SELECTION_ARGS=(--shard="$SHARD")
if [ -f config/scripts/ci-e2e-shard-plan.mjs ]; then
if [ "$TEST_LEVEL_SHARDS" = true ]; then
mkdir -p ci-shards-changed
pnpm exec playwright test "${TEST_FILES[@]}" --config tests/playwright.config.ts --project=electron-headless "${E2E_PROJECT_ARGS[@]}" --shard="$SHARD" --list --reporter=json > ci-shards-changed/selected-discovery.json
elif [ -f config/scripts/ci-e2e-shard-plan.mjs ]; then
mkdir -p ci-shards-changed
pnpm exec playwright test "${TEST_FILES[@]}" --config tests/playwright.config.ts --project=electron-headless "${E2E_PROJECT_ARGS[@]}" --list --reporter=json > ci-shards-changed/discovery.json
export ORCA_SHARD_SOURCE_SHA="$(git rev-parse HEAD)"
+2
View File
@@ -1438,6 +1438,8 @@ jobs:
# Why the merge commit, unlike `e2e`: a gate must test what lands on main, not a stale head.
ref: ${{ github.sha }}
test_files: '["tests/e2e/workspace-layout-oracle-headless.spec.ts","tests/e2e/workspace-layout-oracle.spec.ts"]'
# Two ~3.6 min halves of the 21 window scenarios keep this gate off the PR's critical path.
changed_e2e_test_shards: '["1/2","2/2"]'
run_changed_e2e: true
needs_build: true
artifact_suffix: -layout-oracle