Skip to content

CI: speed up workflows — run tests and linters directly on the runner - #768

Merged
obenland merged 1 commit into
trunkfrom
update/faster-ci
Aug 31, 2026
Merged

CI: speed up workflows — run tests and linters directly on the runner#768
obenland merged 1 commit into
trunkfrom
update/faster-ci

Conversation

@obenland

@obenland obenland commented Aug 31, 2026

Copy link
Copy Markdown
Member

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

  • PHPUnit runs directly on the runner — no wp-env, no Docker. The job downloads the nightly core build and a matching sparse, blob-filtered checkout of 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 via ramsey/composer-install.
    • The tests bootstrap now resolves the vendor autoloader on plain host checkouts (wp-env's /var/www/html mapping still wins in the container), loads the .wp-env/wporg-locales.php stand-in when it isn't mapped in as an mu-plugin, and bridges the WP_TESTS_CONFIG_FILE_PATH env var to the constant the test library reads — the same shim wp-phpunit provides. npm run test:php against the local wp-env test environment is unchanged and still passes (verified: 139 tests both ways).
  • node_modules is cached whole, keyed on package-lock.json + .nvmrc, with npm ci only 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 the wporg-repo-tools setup action, which installed svn, ran cold composer install + npm install, and built all three workspaces even for jobs that never touch build output.
  • Linting split into parallel jobs: PHP (Composer only — no Node at all) and JS/CSS (Node only — no Composer), instead of one job that installed everything.
  • PR concurrency cancellation: pushing a fixup cancels the superseded run.
  • Actions pinned to current releases, replacing the deprecated node16-era actions/checkout v3 pins.

Measured impact (runs on this PR)

Job Before Cold caches Warm caches
Unit tests / PHP ~5m58s 40s 43s
Unit tests / JS ~4m15s 4m18s 43s
Lint / PHP ~4m30s 18s 16s
Lint / JS & CSS ~4m30s 4m21s 44s

Cold runs only pay npm ci again 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

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>
Copilot AI lite review requested due to automatic review settings August 31, 2026 17:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@obenland
obenland merged commit eef4df9 into trunk Aug 31, 2026
8 checks passed
@obenland
obenland deleted the update/faster-ci branch August 31, 2026 17:59
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.

2 participants