Skip to content

Improved E2E CI runtime#27654

Open
JohnONolan wants to merge 1 commit intoTryGhost:mainfrom
JohnONolan:codex/speed-up-e2e-ci
Open

Improved E2E CI runtime#27654
JohnONolan wants to merge 1 commit intoTryGhost:mainfrom
JohnONolan:codex/speed-up-e2e-ci

Conversation

@JohnONolan
Copy link
Copy Markdown
Member

@JohnONolan JohnONolan commented May 3, 2026

What changed

Shave 2 minutes off E2E tests

  • Split CI E2E execution into main-project shards and analytics-project shards.
  • Run the main E2E shards without Tinybird/analytics infrastructure.
  • Keep analytics coverage in a dedicated two-shard lane with Tinybird enabled.
  • Added script support for selecting Playwright projects via E2E_PLAYWRIGHT_PROJECTS and for toggling analytics infra via GHOST_E2E_ANALYTICS.

Why

Every E2E shard was paying the setup cost for analytics infrastructure even though most tests run in the main Playwright project and do not need Tinybird. This keeps the existing coverage shape while removing repeated Tinybird setup from the main shards.

@JohnONolan JohnONolan requested a review from 9larsons as a code owner May 3, 2026 05:30
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

Walkthrough

The E2E CI job now uses a per-shard include matrix containing projectName, projects, analytics, shardIndex, and shardTotal. GHOST_E2E_ANALYTICS controls whether analytics/Tinybird compose files and services are started; Tinybird CLI pull/build and Tinybird sync steps run only when analytics is enabled. isTinybirdAvailable() returns false when analytics is disabled. Playwright runs receive E2E_PLAYWRIGHT_PROJECTS and invoke playwright test with per-project --project args. Uploaded artifact names include projectName and shardIndex.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Improved E2E CI runtime' is vague and does not convey the specific technical changes being made, such as analytics infrastructure optimization or shard-based configuration. Consider a more descriptive title that highlights the key change, such as 'Split E2E CI into main and analytics shards' or 'Make Tinybird analytics optional in E2E CI pipeline'.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly explains the changes, rationale, and technical approach for splitting E2E tests into separate shards to reduce CI runtime by eliminating redundant Tinybird infrastructure setup.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@JohnONolan JohnONolan changed the title Improved E2E CI runtime [WIP] Improved E2E CI runtime May 3, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)

1370-1379: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Pass GHOST_E2E_ANALYTICS into the Playwright container step too.

run-playwright-container.sh forwards this variable with a default of true, but this step never sets it. Main shards therefore still run the container with analytics effectively enabled, which makes the container behavior diverge from the new infra setup/teardown wiring.

Proposed fix
       - name: Run e2e tests in Playwright container
         env:
           TEST_WORKERS_COUNT: 1
           GHOST_E2E_MODE: build
           GHOST_E2E_IMAGE: ${{ steps.load.outputs.image-tag }}
+          GHOST_E2E_ANALYTICS: ${{ matrix.analytics }}
           E2E_PLAYWRIGHT_PROJECTS: ${{ matrix.projects }}
           E2E_SHARD_INDEX: ${{ matrix.shardIndex }}
           E2E_SHARD_TOTAL: ${{ matrix.shardTotal }}
           E2E_RETRIES: 2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 1370 - 1379, The Playwright container
step "Run e2e tests in Playwright container" does not pass GHOST_E2E_ANALYTICS
into the container, so add GHOST_E2E_ANALYTICS to that step's env block (the
same place where TEST_WORKERS_COUNT, GHOST_E2E_MODE, GHOST_E2E_IMAGE, etc. are
defined) so run-playwright-container.sh receives and forwards the value (rather
than relying on its default). Ensure the env key name is exactly
GHOST_E2E_ANALYTICS and reference the workflow-level value (e.g. use the
workflow/existing env interpolation used elsewhere) so main shards get the
intended setting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e/scripts/infra-down.sh`:
- Around line 9-19: The stop command can miss tearing down analytics services
when ANALYTICS_ENABLED=false because compose.dev.analytics.yaml and the
analytics service names aren't included; update the teardown to always target
the analytics compose and service names by creating a stop-specific
compose_files_stop that includes -f compose.dev.yaml and -f
compose.dev.analytics.yaml (or otherwise ensure compose.dev.analytics.yaml is
passed for stop) and build a services_to_stop array that always contains
analytics, tb-cli, tinybird-local plus the existing services array, then call
docker compose "${compose_files_stop[@]}" stop "${services_to_stop[@]}"; adjust
the variables ANALYTICS_ENABLED, compose_files, services, and the docker compose
stop invocation accordingly.

---

Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 1370-1379: The Playwright container step "Run e2e tests in
Playwright container" does not pass GHOST_E2E_ANALYTICS into the container, so
add GHOST_E2E_ANALYTICS to that step's env block (the same place where
TEST_WORKERS_COUNT, GHOST_E2E_MODE, GHOST_E2E_IMAGE, etc. are defined) so
run-playwright-container.sh receives and forwards the value (rather than relying
on its default). Ensure the env key name is exactly GHOST_E2E_ANALYTICS and
reference the workflow-level value (e.g. use the workflow/existing env
interpolation used elsewhere) so main shards get the intended setting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7a4a7688-d832-4cc1-ae92-2d094a8dbcce

📥 Commits

Reviewing files that changed from the base of the PR and between 0c4d441 and 1b5ddd5.

📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • e2e/helpers/environment/environment-manager.ts
  • e2e/helpers/environment/service-availability.ts
  • e2e/scripts/infra-down.sh
  • e2e/scripts/infra-up.sh
  • e2e/scripts/prepare-ci-e2e-build-mode.sh
  • e2e/scripts/run-playwright-container.sh

Comment thread e2e/scripts/infra-down.sh Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.17%. Comparing base (0c4d441) to head (9860995).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #27654      +/-   ##
==========================================
- Coverage   73.17%   73.17%   -0.01%     
==========================================
  Files        1561     1561              
  Lines      127051   127051              
  Branches    15383    15379       -4     
==========================================
- Hits        92970    92966       -4     
- Misses      33105    33126      +21     
+ Partials      976      959      -17     
Flag Coverage Δ
admin-tests 49.86% <ø> (-0.02%) ⬇️
e2e-tests 73.17% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JohnONolan JohnONolan force-pushed the codex/speed-up-e2e-ci branch from 1b5ddd5 to 41e05c7 Compare May 3, 2026 05:45
ref TryGhost#27654

- E2E CI was starting Tinybird for every shard, but only analytics tests need it

- splitting main and analytics shards keeps normal test runs lean while preserving analytics coverage

- teardown still stops analytics services so switching modes leaves a clean compose project
@JohnONolan JohnONolan force-pushed the codex/speed-up-e2e-ci branch from 41e05c7 to 9860995 Compare May 3, 2026 16:34
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)

1371-1379: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Propagate GHOST_E2E_ANALYTICS into the Playwright container run step.

run-playwright-container.sh defaults this var to true when unset, so Main shards currently lose the explicit analytics-disabled signal inside the container. Pass the matrix value through to keep behavior consistent end-to-end.

Suggested patch
       - name: Run e2e tests in Playwright container
         env:
           TEST_WORKERS_COUNT: 1
           GHOST_E2E_MODE: build
           GHOST_E2E_IMAGE: ${{ steps.load.outputs.image-tag }}
+          GHOST_E2E_ANALYTICS: ${{ matrix.analytics }}
           E2E_PLAYWRIGHT_PROJECTS: ${{ matrix.projects }}
           E2E_SHARD_INDEX: ${{ matrix.shardIndex }}
           E2E_SHARD_TOTAL: ${{ matrix.shardTotal }}
           E2E_RETRIES: 2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 1371 - 1379, The Playwright container
run step is not passing the GHOST_E2E_ANALYTICS matrix value into the container,
so the run-playwright-container.sh script defaults to true; update the CI job
env block for the step that executes run-playwright-container.sh to include
GHOST_E2E_ANALYTICS: ${{ matrix.GHOST_E2E_ANALYTICS }} so the variable is
propagated into the container and the script receives the explicit analytics
setting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 1371-1379: The Playwright container run step is not passing the
GHOST_E2E_ANALYTICS matrix value into the container, so the
run-playwright-container.sh script defaults to true; update the CI job env block
for the step that executes run-playwright-container.sh to include
GHOST_E2E_ANALYTICS: ${{ matrix.GHOST_E2E_ANALYTICS }} so the variable is
propagated into the container and the script receives the explicit analytics
setting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 620e9eaf-6520-4bc8-917f-00e9e5a52548

📥 Commits

Reviewing files that changed from the base of the PR and between 41e05c7 and 9860995.

📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • e2e/helpers/environment/environment-manager.ts
  • e2e/helpers/environment/service-availability.ts
  • e2e/scripts/infra-down.sh
  • e2e/scripts/infra-up.sh
  • e2e/scripts/prepare-ci-e2e-build-mode.sh
  • e2e/scripts/run-playwright-container.sh
✅ Files skipped from review due to trivial changes (3)
  • e2e/helpers/environment/environment-manager.ts
  • e2e/scripts/prepare-ci-e2e-build-mode.sh
  • e2e/scripts/infra-down.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e/scripts/run-playwright-container.sh

@JohnONolan JohnONolan changed the title [WIP] Improved E2E CI runtime Improved E2E CI runtime May 3, 2026
@JohnONolan JohnONolan assigned 9larsons and unassigned 9larsons May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants