Repository navigation
ci: run only changed E2E specs on pull requests - #11834
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
📝 WalkthroughWalkthroughThe pull-request workflow now detects changed ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR restructures PR CI to run only the changed
Confidence Score: 4/5Safe to merge — the CI restructuring is well-contained and the new contract tests lock in the intended behavior. The changes are CI-only with no production code impact. The Files Needing Attention:
|
| Filename | Overview |
|---|---|
| .github/workflows/pr.yml | Narrows E2E detection to only *.spec.ts files and propagates a JSON file list to e2e.yml; the if: should_run == 'true' guard on the e2e job is preserved, so the workflow is never called with an empty spec list. |
| .github/workflows/e2e.yml | Adds test_files workflow_call input; full 10-shard e2e job and ssh-docker-watcher-isolation are gated to test_files == ''; new changed-e2e job expands the JSON spec list with mapfile/jq and runs a single-worker Playwright pass. |
| .github/workflows/golden-e2e-experiment.yml | PR trigger and the associated merge-ref checkout comment removed; now only runnable via workflow_dispatch. |
| .github/workflows/linux-wayland-gpu-sandbox.yml | PR trigger, base-checkout repro step, and 'Require base reproduction' gate removed; only the positive workaround verification step remains, now only runnable on demand. |
| .github/workflows/terminal-ime-e2e.yml | PR trigger and its long path list removed; workflow now only runs on schedule (daily 09:30) and workflow_dispatch. |
| .github/workflows/win-crash-survival-e2e.yml | PR trigger and extensive path filter list removed; workflow_dispatch is the only remaining trigger for this expensive Windows packaging+crash proof. |
| .github/workflows/windows-terminal-restart-e2e.yml | PR trigger and path list removed; workflow_dispatch-only now. |
| .github/workflows/computer-e2e.yml | Desktop E2E steps (pnpm test:e2e:computer) removed from the PR native-smoke job; native unit/smoke steps remain, so coverage is not fully zeroed for computer-use on PRs. |
| config/scripts/pr-e2e-gate-contract.test.mjs | Contract tests updated to assert new split (changed-e2e vs full shards), test_files propagation, --diff-filter=AMCR, and absence of PR triggers from dedicated workflows. |
| config/scripts/computer-e2e-workflow.test.mjs | Updated to verify that desktop E2E steps are absent from PR native-smoke jobs and present only in scheduled jobs. |
| config/scripts/package-electron-runtime-contract.test.mjs | Updated to assert pull_request is undefined on the golden workflow and workflow_dispatch is defined, replacing the old path-list assertions. |
| config/scripts/terminal-ime-e2e-workflow.test.mjs | Updated to assert no PR trigger and that the only active triggers are schedule and workflow_dispatch. |
| config/scripts/win-crash-survival-e2e.test.mjs | Updated to assert no PR trigger and the presence of workflow_dispatch; path-list assertions removed. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
PR[pull_request event] --> EPaths[e2e-paths\ndetect changed e2e specs]
EPaths -->|should_run == false| Skip[e2e job skipped]
EPaths -->|should_run == true\ntest_files = JSON array| E2EJob[e2e job in pr.yml]
E2EJob -->|calls e2e.yml with test_files| E2EWorkflow[e2e.yml workflow_call]
E2EWorkflow -->|test_files != empty| ChangedE2E[changed-e2e\nsingle runner\npnpm test:e2e files --workers=1]
E2EWorkflow -->|test_files == empty| FullSuite[e2e 10 shards]
E2EWorkflow -->|test_files == empty| SSHDocker[ssh-docker-watcher-isolation]
Schedule[schedule or workflow_dispatch] --> E2EWorkflow
Schedule --> Golden[golden-e2e-experiment\nno PR trigger]
Schedule --> Wayland[linux-wayland-gpu-sandbox\nno PR trigger]
Schedule --> IME[terminal-ime-e2e\nno PR trigger]
Schedule --> WinCrash[win-crash-survival-e2e\nno PR trigger]
Schedule --> WinRestart[windows-terminal-restart-e2e\nno PR trigger]
Reviews (1): Last reviewed commit: "ci: run only changed e2e specs on pull r..." | Re-trigger Greptile
| if: inputs.test_files != '' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
|
|
||
| - name: Install native build and headless UI tools | ||
| run: sudo apt-get update && sudo apt-get install -y build-essential python3 xvfb | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: package.json | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v6 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Use external node-gyp to avoid pnpm's bundled copy | ||
| run: | | ||
| npm install -g [email protected] | ||
| echo "npm_config_node_gyp=$(npm root -g)/node-gyp/bin/node-gyp.js" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Download E2E build output | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: e2e-build-out | ||
| path: out/ | ||
|
|
||
| - name: Run changed E2E specs | ||
| env: | ||
| TEST_FILES_JSON: ${{ inputs.test_files }} | ||
| run: | | ||
| mapfile -t TEST_FILES < <(jq -r '.[]' <<<"$TEST_FILES_JSON") | ||
| xvfb-run --auto-servernum env SKIP_BUILD=1 ORCA_E2E_FORWARD_APP_LOGS=1 \ | ||
| pnpm run test:e2e "${TEST_FILES[@]}" --workers=1 |
There was a problem hiding this comment.
Empty JSON array bypasses the empty-string guard
The changed-e2e job activates when inputs.test_files != ''. An empty JSON array '[]' satisfies that condition, but jq -r '.[]' <<< '[]' emits no output, so mapfile populates TEST_FILES as an empty bash array. The command then expands to pnpm run test:e2e --workers=1 with no file arguments — which could run the entire suite on a single worker (or error, depending on how Playwright handles zero positional spec arguments).
This can't currently occur from pr.yml — the e2e job is gated by should_run == 'true', which only fires when TEST_FILES_JSON != '[]', and test_files is not exposed as a workflow_dispatch input. The risk is latent: any future workflow_call consumer that passes '[]' would hit this path silently. A guard like if [ "${#TEST_FILES[@]}" -eq 0 ]; then echo "No specs to run"; exit 0; fi after the mapfile line would close the gap without affecting the happy path.
| - name: Filter changed E2E specs | ||
| id: filter | ||
| run: | | ||
| set -euo pipefail | ||
| BASE="${{ github.event.pull_request.base.sha }}" | ||
| HEAD="${{ github.event.pull_request.head.sha }}" | ||
| # Why: capture first so a failed git diff does not look like "no matches" | ||
| # (pipeline status in `if` is not aborted by set -e). Merge-base limits the | ||
| # list to files this PR introduced, not base-branch drift. | ||
| CHANGED="$(git diff --name-only --merge-base "$BASE" "$HEAD")" | ||
| # Why: tests/playwright.config.ts sits beside tests/e2e/, not inside it, so | ||
| # it needs its own pattern — a bare `playwright.` prefix matches no tracked | ||
| # file and would silently skip E2E when the runner config changes. | ||
| if printf '%s\n' "$CHANGED" | grep -E '^(tests/e2e/|tests/playwright\.|\.github/workflows/e2e\.yml$)' >/dev/null; then | ||
| CHANGED="$(git diff --name-only --diff-filter=AMCR --merge-base "$BASE" "$HEAD")" | ||
| TEST_FILES="$(printf '%s\n' "$CHANGED" | grep -E '^tests/e2e/.*\.spec\.ts$' || true)" | ||
| TEST_FILES_JSON="$(printf '%s\n' "$TEST_FILES" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(length > 0))')" | ||
| echo "test_files=$TEST_FILES_JSON" >> "$GITHUB_OUTPUT" | ||
| if [ "$TEST_FILES_JSON" != '[]' ]; then | ||
| echo "should_run=true" >> "$GITHUB_OUTPUT" | ||
| echo "E2E path changes detected" | ||
| echo "Changed E2E specs: $TEST_FILES_JSON" | ||
| else | ||
| echo "should_run=false" >> "$GITHUB_OUTPUT" | ||
| echo "No E2E path changes" | ||
| echo "No changed E2E specs" | ||
| fi |
There was a problem hiding this comment.
E2E helper, config, and shared-fixture changes are now invisible to PR CI
The previous filter matched any file under tests/e2e/ or tests/playwright.*, so changes to shared helpers, global-setup.ts, global-teardown.ts, and tests/playwright.config.ts triggered a full shard run. The new regex ^tests/e2e/.*\.spec\.ts$ is spec-files-only, meaning a breaking change to tests/e2e/helpers/, Playwright config options, or the global setup/teardown will pass PR CI with no E2E validation at all. Failures would only surface on the next scheduled run. This tradeoff is consistent with the stated "PR E2E is advisory" policy and the existing comment that the suite is currently red on main, but it's worth keeping in mind that infrastructure-level regressions in the test harness itself won't be caught until a nightly run.
Summary
tests/e2e/**/*.spec.tsfiles on PRs, using one runnerValidation
pnpm exec vitest run --config config/vitest.config.ts config/scripts/pr-e2e-gate-contract.test.mjs config/scripts/computer-e2e-workflow.test.mjs config/scripts/terminal-ime-e2e-workflow.test.mjs config/scripts/win-crash-survival-e2e.test.mjs config/scripts/package-electron-runtime-contract.test.mjs config/scripts/release-e2e-dispatch-contract.test.mjs