Skip to content

fix(ci): get wp-env CI green on current GitHub runners#287

Merged
epeicher merged 4 commits into
trunkfrom
fix/wp-env-double-mount
Jun 3, 2026
Merged

fix(ci): get wp-env CI green on current GitHub runners#287
epeicher merged 4 commits into
trunkfrom
fix/wp-env-double-mount

Conversation

@epeicher

@epeicher epeicher commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes the wp-env CI breakage (PHPUnit + Plugin Check jobs) that started with the late-May 2026 GitHub runner image rollout, blocking #285. Node-agnostic (no Node pin).

Root cause

wp-env start's downloadSources extracts URL/zip sources with extract-zip (which uses yauzl). On Node 24.16.0 (a libuv 1.52.1 regression) that extraction hangs without leaving an active event-loop handle, so wp-env start silently exits 0 without booting Docker; wp-env run then reports Environment not initialized. Bisected: Node 24.15.0 ✅, 24.16.0 ❌ (OS-independent). The ~May 2026 runner image bumped actions/setup-node '24' past 24.15.0. The core git source is unaffected — only zip sources hang.

Confirmed upstream: WordPress/gutenberg#78762 (issue) and #78828 (fix: replace extract-zip with adm-zip) — not yet in a released @wordpress/env.

Changes

  1. @wordpress/env 10.39 → 11.7 — MySQL healthcheck for the MariaDB lts 12.x readiness regression.
  2. Drop the redundant "." plugin entry in .wp-env.json. wp-env activates each plugins entry by its checkout-dir basename, so "." double-mounts the plugin on any dir not named desktop-mode (worktrees, local clones) and fatals with Cannot redeclare …. The desktop-mode mapping already mounts it.
  3. Drop the gutenberg.zip plugin source — this URL source is the one that hangs wp-env start on Node 24.16+. bin/setup-wp-env.sh (afterStart) already installs+activates gutenberg via wp-cli (PHP installer, no yauzl), so the environment is unchanged and the fix needs no Node pin.
  4. Plugin Check runs in our own wp-env. The wordpress/plugin-check-action@v1 runs its own setup-node@… node-version: '24', so it always uses 24.16.0 and can't be pinned — it hits the same hang via plugin-check.zip. Instead we mount the built plugin via a dedicated --config (core git source only), install Plugin Check via wp-cli, and parse the JSON so real errors still fail. ignore-codes=wp_function_not_compatible_with_requires_wp suppresses the false positive for the function_exists()-guarded WP 6.9 wp_enqueue_command_palette_assets() call.

Verification

CI green on this branch (PHPUnit 8.3 / 8.4, Plugin Check, Lint·Types·Vitest).

epeicher added 2 commits June 2, 2026 20:47
…lugin

The '.' entry in `plugins` mounts the checkout under its directory
basename, while `mappings` also mounts it as `desktop-mode`. For any
checkout whose folder is not named `desktop-mode` (git worktrees, or a
clone under a different directory name) the plugin loads twice and
fatals with "Cannot redeclare desktop_mode_cascade_deactivate_dependents()"
during activation, so `wp-env start` aborts.

The `mappings` entry already mounts the plugin as `desktop-mode`, and
bin/setup-wp-env.sh activates it, so the '.' entry is redundant. Removing
it makes `wp-env start` (and `npm run test:php:install` / `test:php`)
work for every checkout directory name.
A recent `mariadb:lts` release (MariaDB 12.x) broke wp-env's database
readiness. Without a healthcheck, the WordPress/CLI containers start
before MySQL is ready, so `wp-env start` fails to bring up the tests
environment: `service "tests-cli" is not running` in CI, and
`Error establishing a database connection ... at tests-mysql` locally.

@wordpress/env 11.0.0 adds a MySQL healthcheck
(healthcheck.sh --connect --innodb_initialized) plus
MARIADB_AUTO_UPGRADE=1 and `depends_on: condition: service_healthy`,
which fixes startup against MariaDB 12.x.
See WordPress/gutenberg#75046

Verified locally (with 11.7.0): env:start brings up all containers with
mysql/tests-mysql healthy, and the full PHPUnit suite passes.
@epeicher epeicher changed the title fix(wp-env): drop redundant '.' plugin entry that double-mounts the plugin fix(wp-env): MySQL healthcheck via @wordpress/env 11.x + drop redundant '.' mount Jun 2, 2026
epeicher added 2 commits June 3, 2026 08:25
On cold CI runners, wp-env start's host-side downloadSources hangs on zip
plugin sources (got/extract-zip): the zip extracts but the promise never
resolves, the event loop drains, and the process exits 0 before bringing up
the WordPress containers or recording the runtime. wp-env run then reports
"Environment not initialized" and test:php:install fails. The core git
source is unaffected; only zip sources hang.

bin/setup-wp-env.sh (afterStart) already installs and activates gutenberg
via wp-cli, so the gutenberg.zip entry was redundant. Dropping it removes
the flaky host-side download while keeping gutenberg in the environment.
wordpress/plugin-check-action@v1 generates its own .wp-env.json that pulls
the Plugin Check plugin from a zip source, hitting the same cold-runner
wp-env start hang (and it overwrites any config we provide). Run Plugin
Check in our own wp-env: a dedicated --config that mounts the built plugin
and uses only the reliable core git source, with Plugin Check installed via
wp-cli, parsing the JSON output so real errors still fail the build.

Suppress wp_function_not_compatible_with_requires_wp via --ignore-codes:
wp_enqueue_command_palette_assets() (WP 6.9) is called behind a
function_exists() guard in includes/render/assets.php, which is the correct
pattern, so the finding is a false positive.
@epeicher epeicher changed the title fix(wp-env): MySQL healthcheck via @wordpress/env 11.x + drop redundant '.' mount fix(ci): get wp-env CI green on current GitHub runners Jun 3, 2026
@epeicher epeicher force-pushed the fix/wp-env-double-mount branch from e50171b to 3f4bac5 Compare June 3, 2026 07:33
@epeicher epeicher changed the title fix(ci): get wp-env CI green on current GitHub runners fix(ci): pin Node 24.15.0 to fix wp-env CI on current runners Jun 3, 2026
@epeicher epeicher force-pushed the fix/wp-env-double-mount branch from 3f4bac5 to e50171b Compare June 3, 2026 07:51
@epeicher epeicher changed the title fix(ci): pin Node 24.15.0 to fix wp-env CI on current runners fix(ci): get wp-env CI green on current GitHub runners Jun 3, 2026
@epeicher epeicher merged commit d9ea190 into trunk Jun 3, 2026
10 checks passed
@epeicher epeicher deleted the fix/wp-env-double-mount branch June 3, 2026 07:56
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.

1 participant