CI: speed up workflows — run tests and linters directly on the runner - #768
Merged
Conversation
Nearly all CI time was setup: each job installed Composer and npm dependencies cold and built every workspace, and the PHP test job booted a full wp-env Docker environment — ~4-6 minutes of setup to run seconds of tests. - Run PHPUnit directly on the runner against the nightly core build and a matching sparse checkout of wordpress-develop's test library, with the runner's bundled MySQL. No more wp-env/Docker in CI; both are cached with a daily key. The tests bootstrap now resolves the vendor autoloader on plain host checkouts, loads the locale stand-in when it isn't mapped in as an mu-plugin, and bridges the config-path env var that wp-env's test library shim used to provide. - Cache node_modules keyed on the lock file, running npm ci only on a miss, via a new local composite action shared by the JS test, lint, and build-blocks jobs. The repo-tools setup action (svn install, cold installs, building all workspaces even for linting) is retired. - Split linting into parallel PHP (Composer-only, cached via ramsey/composer-install) and JS/CSS jobs. - Cancel superseded runs on PR pushes. - Pin current action releases, replacing the deprecated node16-era checkout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Nearly all CI time is setup, not work: on recent runs the JS test job spent ~4m05s installing to run 6s of Jest, and the PHP test job spent ~5m50s (repo-tools setup + a full wp-env Docker boot) to run 7s of PHPUnit. Inspired by WordPress/wporg-mu-plugins#756, this restructures the workflows so each job sets up only what its seconds of real work need.
Changes
wordpress-develop's test library (both cached with a daily key, ~20s cold and parallelized), starts the runner's bundled MySQL, and runs the multisite suite via a checked-in.github/wp-tests-config.php. Composer is cached viaramsey/composer-install./var/www/htmlmapping still wins in the container), loads the.wp-env/wporg-locales.phpstand-in when it isn't mapped in as an mu-plugin, and bridges theWP_TESTS_CONFIG_FILE_PATHenv var to the constant the test library reads — the same shim wp-phpunit provides.npm run test:phpagainst the local wp-env test environment is unchanged and still passes (verified: 139 tests both ways).node_modulesis cached whole, keyed onpackage-lock.json+.nvmrc, withnpm cionly on a miss — via a new local composite action (.github/actions/setup-node-deps) shared by the JS test, JS/CSS lint, and build-blocks jobs. This retires thewporg-repo-toolssetup action, which installed svn, ran coldcomposer install+npm install, and built all three workspaces even for jobs that never touch build output.actions/checkoutv3 pins.Measured impact (runs on this PR)
Cold runs only pay
npm ciagain when the lock file changes, plus the first daily WordPress-nightly download (~20s); every following run reuses the caches. The PHP jobs are fast even cold since they never install Node dependencies.🤖 Generated with Claude Code