Skip to content

CI: Build once for the E2E tests and add swap space (wp/7.0) - #85782

Merged
desrosj merged 2 commits into
wp/7.0from
fix/wp-7.0-e2e-build-once
Oct 28, 2026
Merged

desrosj merged 2 commits into
wp/7.0from
fix/wp-7.0-e2e-build-once

Conversation

@desrosj

@desrosj desrosj commented Oct 27, 2026

Copy link
Copy Markdown
Member

What?

Backports the build-once part of #81031 to wp/7.0. A single Build job runs npm run build -- --skip-types and uploads the result, and the E2E jobs download it instead of each building on their own. The Build job also adds a 4 GB swap file first.

Why?

On this branch, each of the eight Playwright shards runs its own build. The build starts many processes at once (an esbuild build and a sass-embedded compiler per package). This issue can be encountered on runs with fewer resources, such as those used within private forks: occasionally the kernel refuses to start one more process, and a shard fails in "Npm build" with [plugin sass-plugin] spawn ENOMEM.

Trunk also limits how many builds wp-build runs at once (#79889). That change is in packages/wp-build, the published @wordpress/build package, so it isn't backported here. This PR only changes the workflow.

How?

Two commits:

  1. Build once. Adds a build job and the build-output artifact, and makes the test jobs depend on it. The artifact paths are CI: build once and reuse the build across e2e tests shards #81031's: the build* directories, plus the generated icon library, worker code and block parser files, which are the same on this branch. A failed build makes the test jobs fail rather than skip, as in CI: build once and reuse the build across e2e tests shards #81031. This branch's runners, timeouts and Playwright install are left unchanged; the rest of CI: build once and reuse the build across e2e tests shards #81031 (vars.RUNNERS_NAME, shorter timeouts, setup-playwright) isn't included.
  2. Add swap space. Adds a 4 GB /mnt/swapfile-build before the build. The hosted image already has 3 GB of swap. The extra file raises the memory the kernel lets processes commit (about 10.8 GB to 14.8 GB), which is the limit it checks when starting a process.

Testing Instructions

  • In the E2E run on this PR, the Build job uploads build-output, all eight test jobs download it, and the tests run as before.
  • Measured under the limits of private-repository runners (7 GB, 2 CPUs), the build peaks at about 3.7–4.5 GB with about 800–1,000 processes, and never used swap (Experiment: Add swap before the E2E build (wp/7.0) desrosj/gutenberg#855). The swap step ran without issue on every shard there.

🤖 Generated with Claude Code

https://claude.ai/code/session_011Y86gzn3apHfS8kjjkmzTW

desrosj and others added 2 commits October 27, 2026 16:48
Backports the build-once part of #81031 (4028b8e)
to this branch. Each of the eight Playwright shards ran its own
`npm run build`. A single Build job now builds and uploads the output, and
each shard downloads it.

This branch's runners, timeouts and Playwright install are left unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gzn3apHfS8kjjkmzTW
The build starts many processes at once. On runners with fewer resources,
such as those used by private forks, the kernel can occasionally refuse to
start another one, failing the build with `spawn ENOMEM`. A 4 GB swap file
raises the amount of memory that can be committed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gzn3apHfS8kjjkmzTW
@desrosj desrosj self-assigned this Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2a5b304-0179-41c4-99a8-28d894166ff5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

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

@desrosj
desrosj marked this pull request as ready for review October 27, 2026 20:54
@desrosj desrosj added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@desrosj
desrosj requested a review from sirreal October 27, 2026 20:56
@desrosj
desrosj added this pull request to stack #85790 October 27, 2026 21:05

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Only question for me is whether we still need the "Add swap space" step if we're building once, but the included comments indicate that some environments have fewer resources which seems a good justification to me 👍

@desrosj
desrosj merged commit d163d37 into wp/7.0 Oct 28, 2026
74 of 75 checks passed
@desrosj
desrosj deleted the fix/wp-7.0-e2e-build-once branch October 28, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants