perf(e2e): improve node_modules, Playwright and wp-env home caching#21
Merged
Conversation
Drop the Docker image tar cache (save of all runner images fills the disk). Cache ~/.wp-env instead, with optional wp-env-cache-key for consumers whose env content is not fully reflected in .wp-env.json.
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. Saving all runner images with
docker savealso exhausts disk on GitHub-hosted runners (see polylang-wc e2e failures).Reopened against
mainafter #20 was accidentally merged intoe2e-action-inputs(inputs PR #19) and then reverted there. This PR is cache-only; it does not includewp-env-config-path/playwright-cmd.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.container-cache-keywith optionalwp-env-cache-keyfor consumers whose env content is not fully reflected in.wp-env.json(e.g. WooCommerce version / Polylang Pro SHA).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.docker savestep runs (avoids disk exhaustion).