Skip to content

ci(playwright): only build assets when the pull request changes them - #67638

Draft
susnux wants to merge 2 commits into
masterfrom
ci/playwright-skip-build
Draft

susnux wants to merge 2 commits into
masterfrom
ci/playwright-skip-build

Conversation

@susnux

@susnux susnux commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor
  • Resolves: #

Summary

Playwright is the last workflow to finish on most PRs (22 of 40 sampled pushes). A median run takes 27 min, and 5.3 min of that is the setup job (npm ci + npm run build + saving the whole work tree as a cache) before any shard can start.

The assets in dist/, core/css and apps/*/css are committed after every merge (update-node-dist.yml). So when a PR doesn't touch their sources, the committed assets already match it.

  • PRs without frontend source changes (about 45 % in the sample) skip the setup job entirely. A small changes job on a low runner decides this, and the shards start right after it. Expected: about 4–5 min less on the critical path. The shards still compile the app stylesheets (npm run sass, a few seconds), because the recompile after merges only commits dist/ and core/css, and apps/settings/css/settings.css is currently outdated on master.
  • PRs with frontend changes still build once in the setup job. The shards get only the build output, as an artifact, instead of the whole work tree.
  • Cache: node_modules is now cached per package-lock.json instead of the whole 306 MB work tree per run. Those per-run entries currently fill 10.7 of the repository's 10.97 GB cache, so older caches (including CodeQL's) are evicted constantly. PRs can't read each other's caches, so pushes to master/stable now run only the setup job to keep the shared cache warm. On a cache miss, every job falls back to npm ci.

The required check playwright-test-summary keeps its name. Push runs skip the tests, merge-reports and summary jobs.

Known trade-off: right after a frontend PR is merged, until the "recompile assets" commit lands, a PR without frontend changes tests against the previous assets.

Not included: rebalancing the shards (6.7 to 13.4 min of test time today). That needs per-test durations and will be a separate PR.

TODO

  • Check this PR's run, which takes the skip path because the workflow file is not a build input: setup skipped, shards using the committed assets
  • Check the build path with a temporary frontend commit, then drop it again
  • Check that a push run to master only refreshes the cache

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI
How the build inputs were determined

npm run build runs vite build (entries in apps/*/src and core/src, ~/ alias to the repository root) and build/npm-post-build.sh. That script compiles the SCSS in core/css and apps/*/css and generates dist/icons.css from the SVGs in core/img. The filter also covers apps/*/img, package.json, package-lock.json, tsconfig.json and vite.config.ts. There are no root install scripts, so a node_modules cache keyed by the lockfile is complete. actionlint 1.7.7 reports no findings.

Assisted by ClaudeCode:claude-opus-5-5

🤖 Generated with Claude Code

The setup job built all assets for every pull request and cached the
whole work tree per run, which put about five minutes in front of every
shard and filled the repository cache with 300 MB entries until older
caches were evicted. The assets are committed after every merge, so a
pull request that does not touch their sources can test against the
committed ones and start its shards right away.

When the sources do change, the setup job builds them and passes only
the build output to the shards as an artifact. node_modules is cached
per lockfile instead of per run, and pushes keep that cache warm because
pull requests cannot read each other's caches.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
The asset recompile after merges only commits dist/ and core/css, so
the compiled stylesheets of apps can lag behind their SCSS sources, as
apps/settings/css/settings.css currently does. Compiling them before
the tests keeps the skip path equivalent to a full build; dist/ itself
matches a fresh build.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux

susnux commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Results of the first run (skip path):

  • The setup job was skipped, and the shards started right after the 15 s changes job. They then waited about 45 min for a free runner, which is unrelated to this change.
  • dist/ from a fresh local npm run build is byte-identical to the committed one. The only difference was apps/settings/css/settings.css (stale since 999c00a), so the shards now run npm run sass on the skip path (28fe060).
  • Shard 1 failed once in admin-settings-ai-security.spec.ts (strict-mode match on the toast and its live-region copy) and passed on the re-run.
  • Shards 5 and 6 were killed by a runner shutdown signal on both attempts. The same happens today on PRs using the current workflow (e.g. ci: run tiny test jobs together to cut 36 jobs per push #67632), so it is a runner problem.
  • Every shard missed the node_modules cache and ran npm ci (2 min). That is expected until a master push has created the cache.

Assisted by ClaudeCode:claude-opus-5-5

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants