Skip to content

Build/Test Tools: Allow external callers in the v1 and v2 PHPUnit workflows - #13630

Draft
lucatume wants to merge 1 commit into
WordPress:trunkfrom
lucatume:add/phpunit-v1-v2-external-caller-inputs
Draft

lucatume wants to merge 1 commit into
WordPress:trunkfrom
lucatume:add/phpunit-v1-v2-external-caller-inputs

Conversation

@lucatume

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/66149

The v1 and v2 reusable PHPUnit workflows always check out the calling repository, so a caller in another repository builds WordPress from its own tree. Only v3 accepts a repository, a ref and an overlay artifact, which leaves a caller wanting to test a branch on an older major with the v1 or v2 workflow no option but to keep a copy of the workflow, and that copy inherits none of the fixes that land here.

This adds to v1 and v2 the four inputs v3 already carries, with v3's descriptions and its guard against a repository given without a ref:

  • repository and ref for the checkout
  • overlay-artifact, unpacked over the checkout for callers whose test files are not part of the repository being tested
  • phpunit-test-groups, a list of groups to run

What to check

All four inputs default to an empty string, so no existing caller changes behaviour:

  • repository: ${{ inputs.repository || github.repository }} falls back to github.repository, which is actions/checkout's own default.
  • ref: '' is already actions/checkout's default.
  • the overlay step is guarded by if: inputs.overlay-artifact != ''.
  • every ! inputs.phpunit-test-groups condition is true when the input is unset, so each step keeps its current if.

The repository-without-ref guard matters because actions/checkout would otherwise fall back to the other repository's default branch: a job labelled for an older branch would silently test trunk and report green.

The group handling is the part worth the closest look. Steps with a hard-coded group (ajax, ms-files, external-http, xdebug, the slow-test split) are skipped when the caller names its own groups, since those steps would run tests the caller did not ask for. The PHP < 7 steps are skipped for the same reason in reverse: they run with --exclude-group, which would silently drop the caller's tests if they fall in an excluded group. Caller-named groups therefore run in the single "Run PHPUnit tests" step on every PHP version, which is how v3 behaves.

The group list reaches PHPUnit through an env: var rather than direct interpolation into the run: line.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: analysing the constraint and proposing the diff; I applied and reviewed the change.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

The v1 and v2 reusable PHPUnit workflows always check out the calling
repository, so a caller in another repository builds WordPress from its
own tree. Only v3 accepts a repository, a ref, and an overlay artifact.

Add the four inputs v3 already carries (repository, ref,
overlay-artifact and phpunit-test-groups) with v3's descriptions and
its guard against a repository given without a ref. Steps with a
hard-coded group are skipped when the caller names its own groups.
So are the PHP < 7 steps: they exclude the slow groups, which would
silently drop the caller's tests in those groups. Caller-named groups
run in the single step on every PHP version, as v3 does.
@lucatume lucatume self-assigned this Sep 21, 2026
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.

1 participant