perf(e2e): improve node_modules, Playwright and wp-env home caching#20
Merged
Conversation
`status --json` is only available in @wordpress/env 11+; older versions still expose install-path.
require() looked up packages from the action script path, not the repo root.
Use npm ci when package-lock.json is present; otherwise npm install.
Avoid hashing the lockfile just to decide whether to generate it.
Restore and docker load cost more than they save; wp-env start stays slow either way.
Reuse downloaded WordPress sources across CI runs; pin WP_ENV_HOME for snap-safe path.
Restored workdirs keep config_checksum while MySQL volumes are empty, so skip install breaks REST.
This was referenced Jul 17, 2026
Member
Author
|
This PR was merged into the wrong base ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Improve e2e CI caching for
node_modules, Playwright browsers, and the wp-env home directory (downloaded WordPress sources).Why?
More reliable cache keys and reuse of wp-env downloads reduce CI time without relying on a Docker image tarball (restore +
docker loadwas slower than it helped).How?
Get Node.js versionstep and includepackage.jsonin thenode_modulescache key.@playwright/testversion viabin/get-playwright-version.js(from consumercwd) and add Playwrightrestore-keys.npm install --package-lock-onlywhenpackage-lock.jsonalready exists; usenpm ciwhen a lockfile is present.WP_ENV_HOME, cache that directory, and on cache hit deletewp-env-cache.jsonso wp-env re-runswp core installagainst fresh MySQL volumes while keeping downloaded sources.wp-env-cache-keyinput for consumers whose env content is not fully reflected in.wp-env.json(e.g. WooCommerce version / Polylang Pro SHA).Depends on the inputs PR (
e2e-action-inputs); retarget tomainafter that merges.Split from #17 (cache only).
Test plan
wp-envhome miss → start + tests pass; cache is saved.wp-env-cache.jsonremoved → start reconfigures → tests pass (REST API / global setup OK).package.json/ lockfile and confirmnode_modulescache misses.restore-keys..wp-env.json, WP latest,@wordpress/envversion, orwp-env-cache-keychanges.package-lock.json, confirm lockfile generation is skipped.