Skip to content

CI on main skips the e2e jobs only for a tree that already passed on its pull request - #666

Open
MerciHanrim wants to merge 1 commit into
mainfrom
ci-main-e2e-same-tree
Open

MerciHanrim wants to merge 1 commit into
mainfrom
ci-main-e2e-same-tree

Conversation

@MerciHanrim

Copy link
Copy Markdown
Owner

Why

Every fix ran the full CI twice: about 18 minutes on its pull request and about 18 minutes again on main. With one pull request merged at a time, the run on main re-tested the same files: on #663, #664 and #665 the merge commit held exactly the tree of the approved head. The CI on main does not gate the deploy (Cloudflare Pages deploys main from its own connection). Lumi's decision (2026-11-25): keep the full CI on pull requests, run checks on every push to main, skip the e2e jobs on main only for a tree that already passed, conservatively, and keep a daily and a pre-release full run.

The change

  • e2e decision job (scripts/ci-main-e2e-decision.mjs). A push to main answers run_e2e=false only when all of these hold: one commit on top of the previous main; exactly one pull request merged into main with this commit as its merge commit; its head's required checks checks and e2e from GitHub Actions, latest run of each, completed with success; the head fetched from refs/pull/<n>/head is that commit; the previous main is an ancestor of the head (so the pull request's CI tested the head's own tree); and the merge tree equals the head tree. Anything else, any lookup error, and every other event answer true. The decision and its reason go to the job summary.
  • The e2e jobs (e2e-shard ×8, e2e-dist, e2e-pwa) need the decision job and run unless its answer is exactly false, so the decision job failing or giving no answer runs them in full.
  • The e2e gate passes on a push to main when the decision job succeeded with false (e2e skipped); otherwise it requires every e2e job to succeed, as before.
  • Daily at 03:00 KST (schedule: 0 18 * * *) and by hand (workflow_dispatch, before a release): everything on main. The change-declaration step runs only for a pull request or a push (the other two declare nothing). Their concurrency group includes the event name, so they never queue behind the push run of the same commit.
  • docs/ci-main-e2e.md explains the rules; docs/ci-e2e-shards.md notes where the timing samples now come from.

Cost on a pull request: the e2e jobs start after the decision job (checkout + Node, about 15 to 20 seconds; it answers true at once).

Verification

Every check:* script, tsc -b, lint (88 warnings, the baseline) and vitest run (5770 passed) pass locally.

…its pull request

A push to main now runs checks always and runs the e2e jobs unless a new e2e decision job shows that the merge commit holds the exact tree of a pull request head whose required checks (checks, e2e) passed, and that the previous main is in that head. Anything that cannot be determined, or the decision job failing, runs them in full. A daily run at 03:00 KST and a manual run (before a release) run everything on main. Pull requests run everything, as before.
@MerciHanrim MerciHanrim added the enhancement New feature or request label Nov 24, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying cozy-loop-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: b7b0110
Status: ✅  Deploy successful!
Preview URL: https://cc005101.cozy-loop-studio.pages.dev
Branch Preview URL: https://ci-main-e2e-same-tree.cozy-loop-studio.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant