Skip to content

ci: derive the wp-phpunit constraint from the downloaded WordPress core - #291

Merged
marcoluzi merged 1 commit into
mainfrom
ci/align-wp-phpunit-to-downloaded-core
Aug 24, 2026
Merged

ci: derive the wp-phpunit constraint from the downloaded WordPress core#291
marcoluzi merged 1 commit into
mainfrom
ci/align-wp-phpunit-to-downloaded-core

Conversation

@marcoluzi

Copy link
Copy Markdown
Member

Follow-up to a WordPress 7.1 compatibility check. The package itself needed no changes: the drift lane already runs green against real WP 7.1 (58 tests, 158 assertions), and the 7.1 field guide lists no deprecation or removal touching any API Sproutset uses. This PR fixes the one real problem the check surfaced, which is in the harness rather than the library.

The problem

The latest integration lane hardcoded the wp-phpunit constraint:

if [ "${{ matrix.wp }}" = "latest" ]; then
  CONSTRAINT="^7.0"

That holds only while latest stays inside the 7.x series. Once WordPress 8.0 ships, the lane downloads 8.0 core and pairs it with the 7.x test suite. The job would either break confusingly or, worse, pass while testing a mismatched pair. Either way the drift lane stops detecting drift, which is the only thing it exists to do.

The change

Read the series back off the core that was actually downloaded, and use it for both lanes:

SERIES=$(wp core version --path=/tmp/wordpress | cut -d. -f1,2)

wp core version is annotated @when before_wp_load and reads wp-includes/version.php directly, so it works on a bare wp core download with no wp-config and no database, which is exactly the state of /tmp/wordpress at that point in the job.

The empty-string guard matters: without it, a failed lookup would fall through to wp-phpunit:.* and quietly install whatever Composer felt like.

The pinned 6.7 lane is unaffected in behaviour, it just takes the same code path now instead of its own branch.

Verification

Checked before pushing:

  • YAML parses, the integration job still has its 6 steps.
  • Constraint derivation: 7.1 gives 7.1.*, 6.7.2 gives 6.7.*, 6.7 gives 6.7.*.
  • Both resolve to real packagist releases (7.1.0 and 6.7.7), so neither lane loses its suite.

The rest is what CI proves on this PR. Both integration lanes need to go green.

Also

README requirements now read WordPress 6.7+ (tested up to 7.1).

No PHP changed, so lint, types and Pest are untouched. ci: and docs: are not in changelog-sections, so this is changelog-silent and does not move the version.

The `latest` integration lane hardcoded `wp-phpunit/wp-phpunit:^7.0`. That is
correct only while `latest` stays inside the 7.x series: once WordPress 8.0
ships, the lane would download 8.0 core and pair it with the 7.x test suite,
so the drift lane would stop being a drift lane.

Read the version back off the core that was actually downloaded instead, and
fail the step loudly if that lookup comes up empty rather than falling through
to an unconstrained `wp-phpunit:.*`.

Also record the tested-up-to version in the README requirements.
@marcoluzi
marcoluzi merged commit c52b860 into main Aug 24, 2026
5 checks passed
@marcoluzi
marcoluzi deleted the ci/align-wp-phpunit-to-downloaded-core branch August 24, 2026 12:10
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