Speed up Windows functional tests by using the D: drive - #269
Conversation
The Windows functional (Behat) job is by far the slowest in the matrix, taking well over an hour while the equivalent Linux job finishes in under 30 minutes. Nearly all of that time is the Behat run itself: the suite installs WordPress and spawns a large number of short-lived `wp`/`php` processes per scenario, and on the Windows runner all of that file I/O happens on the slow C: drive. Relocating the temporary files to the runner's fast D: drive roughly halves the Behat run time. The wp-cli-tests framework derives the WP install directory, the core/install/SQLite caches and HOME/COMPOSER_HOME (the WP-CLI cache) from sys_get_temp_dir(), and forwards TEMP/TMP to the spawned `wp` processes, so pointing TEMP/TMP at D: relocates everything in one step. The step is guarded and becomes a no-op if D: is ever unavailable. The D: drive only exists on the windows-2022 image (it was removed from windows-2025, which is also significantly slower), so the Windows matrix entry is pinned to windows-2022.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
@schlessera Is this really true? See
So according to this, the D: drive should be available on windows-2025. And if not, then I am worried about what we do once windows-2022 is deprecated. |
|
@swissspidy Let me test this. |
|
@swissspidy So the D: drive is indeed back and working on |
Follow-up to #128 and wp-cli/.github#269
What
Two changes to the Windows functional (Behat) job:
TEMP/TMPtoD:\Temp, guarded to be a no-op if theD:drive is unavailable.windows-2022(theD:drive was removed fromwindows-2025).No changes to Linux/macOS jobs.
Why
The Windows functional job is by far the slowest in the matrix (well over an hour vs ~30 min on Linux for the same 262 scenarios). Nearly all of it is the Behat run: each scenario installs WordPress and spawns many short-lived
wp/phpprocesses, and on the Windows runner that file I/O all happens on the slow C: drive. GitHub's Windows runners have a read-optimized (slow) C: drive and a fast D: working drive.Because the
wp-cli-testsframework derives the WP install directory (RUN_DIR), the core/install/SQLite caches, andHOME/COMPOSER_HOME(the WP-CLI cache) all fromsys_get_temp_dir(), and forwardsTEMP/TMPto the spawnedwpprocesses, a singleTEMP/TMPredirect relocates everything onto D:.Measurements
Measured on
extension-command(PHP 8.5 / WP trunk / SQLite), every run a full 262/262-scenario clean pass:Redirecting to D: roughly halves the Behat time. Windows runner performance is highly variable (bimodal, ~24 or ~43 min depending on the Azure host), so the result is a band rather than a single number, but the ~2x improvement clears the variance comfortably.
Alternatives considered and rejected
opcache.file_cachemisses across scenarios; only the stable-path framework code is reused, which is negligible, while the bytecode serialization adds a little overhead. Left out to keep the change simple.Notes
continue-on-error(informational), so this only changes how long it takes, not whether it can block a PR.windows-2022trades newest-image coverage for the D: drive; the job exists to catch Windows-specific breakage rather than to track the latest Windows image, and windows-2025 is both slower and lacks the D: drive..githubrepo doesn't run functional tests against itself; the numbers above come from pointing a package'stesting.ymlat this branch.Summary by CodeRabbit