Repository navigation
ci: Fix Composer cache and speed up lint - #1330
Merged
Merged
Conversation
The Composer cache never restored or saved. The workflow cached ~/.composer/cache, but Composer on the runner writes to ~/.cache/composer, so every job downloaded all packages again and logged a "Path Validation Error" on save. Read the real path from `composer config cache-files-dir`. The build matrix key also used the undefined `matrix.php`, so both PHP versions shared one key. Cancel superseded PR runs so a new push does not wait behind an obsolete one. Pushes to develop and master still run to completion. Run PHPCS in parallel processes. Locally this cuts `composer lint` from about 24s to 8s.
utkarshcloudinary
marked this pull request as draft
October 20, 2026 10:10
utkarshcloudinary
marked this pull request as ready for review
October 20, 2026 10:23
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.
No issue. CI speed-up.
Approach
The Composer cache in
ci.ymlwas never used. Every job cached~/.composer/cache, but Composer on the runner writes to~/.cache/composer. So each job got "Cache not found" on restore and a "Path Validation Error" on save. This PR fixes the cache, makes PHPCS faster, and cancels superseded PR runs.composer config cache-files-dirin all four jobs, the same waydeploy-to-wp-org.ymlalready does.matrix.php, so it should bematrix.php-version. The 7.4 and 8.5 jobs now get separate keys.concurrencygroup that cancels a superseded run when a PR gets a new push. Runs ondevelopandmasterpushes are not cancelled.--parallel=8throughphpcs.xml.dist. This also makes the lint-staged pre-commit hook faster.Measured results
Data from run 39405988243: attempt 1 (cold cache) and attempt 2 (warm cache). The baseline is earlier
develop/PR runs.Cache restored from key: Linux-composer-<job>-...), and the save step no longer shows a path error. The time saved is small:composer installtakes about 1.5 to 2.5s with the warm cache and about 3 to 5s before.buildjobs: about 25 to 32s on this branch (4 job runs), against about 36 to 62s before (6 job runs on 3 recent runs). Locally,composer lintdrops from about 24s to 8s.Follow-ups (not in this PR)
For the E2E job, about 1.5 min is
wp-env startand about 1.8 min is the single-worker@serialpass.@serialspecs across a 2-shard matrix, each with its own wp-env.testsEnvironment: falsein CI to boot one site instead of two. The E2E and unit setup use the tests containers, so this needs a config and helper change first.QA notes
Cache restored from key: Linux-composer-.... The post step should not show "Path Validation Error".build (7.4)andbuild (8.5)should use different cache keys (Linux-composer-7.4-...andLinux-composer-8.5-...).npm run lint:phplocally should give the same result as before, only faster.