Skip to content

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

Merged
desrosj merged 2 commits into
fix/wp-7.1-type-build-memoryfrom
fix/wp-7.1-e2e-build-once
Oct 28, 2026
Merged

desrosj merged 2 commits into
fix/wp-7.1-type-build-memoryfrom
fix/wp-7.1-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.1. 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, the eight Playwright shards and the RTC WebSocket job each run 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 nine 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:47
Backports the build-once part of #81031 (4028b8e)
to this branch. Each of the eight Playwright shards and the RTC WebSocket job
ran its own `npm run build`. A single Build job now builds and uploads the
output, and each test job 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: 36020d23-668f-413d-b32f-8853fe643ecd

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 added this pull request to stack #85784 October 27, 2026 20:50
@desrosj
desrosj marked this pull request as ready for review October 27, 2026 20:54
@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 review from a team and sirreal October 27, 2026 20:55
@desrosj desrosj added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

🤖 PR meta 🤖

🏁 Flaky tests

Show the failures

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

should update the URL from the last navigation if only varies in the URL fragment in /test/e2e/specs/interactivity/router-navigate.spec.ts, passed after 1 failed attempt.
Error: expect(locator).toHaveText(expected) failed

Locator:  getByTestId('title')
Expected: "Link 1"
Received: "Main"
Timeout:  5000ms

Call log:
  - Expect "toHaveText" with timeout 5000ms
  - waiting for getByTestId('title')
    14 × locator resolved to <h2 data-testid="title">Main</h2>
       - unexpected value "Main"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/router-navigate.spec.ts:163:25

4d8d26e Run

@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! Same comment as on #85782: 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 commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

the included comments indicate that some environments have fewer resources which seems a good justification to me 👍

That's right! This came up as a problem in private forks. I learned last week that the GitHub hosted runner images for private repositories have less resources than the ones available for public ones.

@desrosj
desrosj merged commit 044cc95 into wp/7.1 Oct 28, 2026
70 of 79 checks passed
@desrosj
desrosj deleted the fix/wp-7.1-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