Opened 7 weeks ago
Closed 5 weeks ago
#65749 closed enhancement (fixed)
Allow the PHPUnit test runner to be set by a repository variable
| Reported by: | lancewillett | Owned by: | lancewillett |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
The PHPUnit workflows run on a fixed runner (ubuntu-24.04), passed as the os input to reusable-phpunit-tests-v3.yml and consumed at runs-on: ${{ inputs.os }}.
This makes the runner overridable by a repository variable, so maintainers can direct the PHPUnit matrices to a specific runner, for example a dedicated runner during high-load release windows, without editing the workflow.
reusable-phpunit-tests-v3.yml changes its runs-on to:
runs-on: ${{ vars.PHPUNIT_RUNNER || inputs.os }}
With the PHPUNIT_RUNNER variable unset (the default), jobs run on inputs.os exactly as today, so there is no behavior change. It is backward-compatible for every branch that calls the workflow at @trunk; no input is added or made required.
Change History (11)
This ticket was mentioned in PR #12745 on WordPress/wordpress-develop by @lancewillett.
7 weeks ago
#1
@lancewillett commented on PR #12745:
7 weeks ago
#2
For this to work, @bazza or another GitHub admin will need to flip the PHPUNIT_RUNNER variable before / after release using GitHub.com settings for WordPress.org.
---
### How to route the PHPUnit matrices to a specific runner
This change is a no-op until a PHPUNIT_RUNNER repository variable exists. To direct the PHPUnit jobs to a runner (for example, a larger release-runner during a high-load release window):
Turn it on
- Repo → Settings → Secrets and variables → Actions → Variables.
- New repository variable → Name:
PHPUNIT_RUNNER, Value: the runner label (e.g.release-runner). - New PHPUnit runs pick it up immediately. In-flight runs are unaffected; re-run if you need them moved.
Turn it off
- Same page → delete the
PHPUNIT_RUNNERvariable. - PHPUnit jobs fall back to the default runner (
ubuntu-24.04).
Notes
- Scoped per repository—set it only on the exact repo you want to redirect; other repos are unaffected.
- Larger hosted runners are billed per-minute, so set it only for the window and remove it after.
- Changing the variable needs repo admin access.
#5
@
6 weeks ago
- Resolution fixed
- Status closed → reopened
I've been thinking about this change, and the PHPUnit testing workflow wordpress-develop is not the only repository responsible for amassing a queue due to long-running jobs. The performance testing workflows both here and in Gutenberg, and the E2E test workflow in Gutenberg can also cause a traffic jam.
I'm going to rename the variable to something more generic so that expanding it's usage to to other workflows and repositories can be considered.
#9
@
6 weeks ago
Reopening. [62891] only covered reusable-phpunit-tests-v3.yml, so the override does not reach every branch that runs the PHPUnit matrices.
Branches 4.7 through 5.1 call reusable-phpunit-tests-v1.yml, and branches 5.2 through 5.8 call reusable-phpunit-tests-v2.yml, both at @trunk. Neither workflow reads the variable; each still has a bare runs-on: ${{ inputs.os }}. Setting RUNNERS_NAME at the repository or organization level therefore has no effect on those twelve branches.
A follow-up PR should apply the same one-line change to both files. With the variable unset, jobs run on inputs.os exactly as before, so there is no change by default.
This ticket was mentioned in PR #12847 on WordPress/wordpress-develop by @lancewillett.
6 weeks ago
#10
Extends r62891 to the two older reusable PHPUnit workflows.
That change added the runs-on override to reusable-phpunit-tests-v3.yml alone, so only branches calling that workflow can be redirected.
Branches 4.7 through 5.1 call reusable-phpunit-tests-v1.yml, and branches 5.2 through 5.8 call reusable-phpunit-tests-v2.yml, both at @trunk. Neither reads the variable, so setting RUNNERS_NAME at the repository or organization level has no effect on those twelve branches.
This applies the same one-line change to both files. With the variable unset, jobs run on inputs.os exactly as before, so there is no change by default.
Each of the three reusable PHPUnit workflows contains exactly one runs-on, so no other line in these files needs the same treatment.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Identifying the gap by comparing which branches call which reusable workflow, drafting the two-line change, and drafting this description. Reviewed and verified by me before opening.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Allows the PHPUnit runner to be directed by a repository variable, defaulting to the current runner.
reusable-phpunit-tests-v3.ymlchanges itsruns-onto${{ vars.PHPUNIT_RUNNER || inputs.os }}. With thePHPUNIT_RUNNERvariable unset (the default), jobs run oninputs.os(ubuntu-24.04) exactly as before. When a maintainer setsPHPUNIT_RUNNERto a runner label, the PHPUnit matrices run on that runner instead—useful for directing them to a dedicated runner during high-load release windows, without editing the workflow.@trunk; no input is added or made required.varsis available inruns-on, so the override is valid.Trac: https://core.trac.wordpress.org/ticket/65749