Skip to content

Only test the PHP versions a PR changes - #53

Merged
rick-lam merged 1 commit into
masterfrom
51/test-only-changed-versions
Oct 22, 2026
Merged

rick-lam merged 1 commit into
masterfrom
51/test-only-changed-versions

Conversation

@rick-lam

Copy link
Copy Markdown
Contributor

Summary

Fixes #51

Every PR tests all PHP versions, whatever it changes, so a PR that only touches one version's folder (for example #47, only 7.4/) runs every version's test and picks up unrelated failures. This makes PRs test only the versions they change.

Notable Changes

  • The matrix job checks out with fetch-depth: 0 and, on pull requests, runs git diff --name-only base...head.
  • If every changed file is inside a version folder listed in versions.json, the test matrix keeps only those versions.
  • Anything else (common/, the workflow, the Makefile, versions.json, the README), a folder not in versions.json, or a failed diff tests every version, as now. The build matrix and pushes to master are unchanged.
  • The step logs Testing: <versions> so the selection is visible in the job log.

QA

Checked locally with the jq filter against versions.json:

Changed files Tested
only 7.4/... 7.4
7.4/ and 8.3/ 7.4, 8.3
7.4/ plus common/php.bats all
workflow, README, versions.json all
unknown folder 9.9/ all
no files all
real diff of #47's branch against master (24 files) 7.4

This PR changes the workflow, so its own CI tests every version. After merge, #47's CI should run only the 7.4 test.

Deployment

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Uugex1w8qZoTbBRbcFwkcp

Every PR built and tested all versions in versions.json, so a change to
one version's folder (such as #47, only 7.4/) also showed unrelated
failures from other versions.

On pull requests the matrix job now diffs the PR against its base. If
every changed file is inside a version folder listed in versions.json,
only those versions are tested. Any other change (common/, the workflow,
the Makefile, versions.json, the README), an unknown folder, or a failed
diff tests every version as before. Pushes to master are unchanged.

Fixes #51

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uugex1w8qZoTbBRbcFwkcp
Copilot AI balanced review requested due to automatic review settings October 22, 2026 04:12
@rick-lam rick-lam self-assigned this Oct 22, 2026
@rick-lam
rick-lam merged commit d28b2bf into master Oct 22, 2026
8 of 14 checks passed
@rick-lam
rick-lam deleted the 51/test-only-changed-versions branch October 22, 2026 04:13

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.

🟡 Changes recommended

Rename detection can omit source paths, causing affected versions or shared-file changes to bypass required testing.

1 open issue
What changed in this PR

This PR narrows PHP test coverage to the versions changed by a pull request, addressing #51 and avoiding unrelated failures on version-specific changes such as #47.

Changes:

  • Fetches full history and uses the PR diff to select affected versions from versions.json.
  • Keeps all-version testing for shared or unknown paths, empty diffs, and diff failures.
  • Logs selected versions while leaving the build matrix and master-push behavior unchanged.
File Description
.github/​workflows/​build.yml Adds PR-specific test matrix selection and selection logging.

Review effort: Balanced

Comment thread .github/workflows/build.yml
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.

Only test the PHP versions a PR changes

2 participants