Skip to content

fix(php-tests): make coverage opt-in; install pcov by default#8

Merged
kojiromike merged 1 commit into
mainfrom
kojiromike/install-coverage-driver-everywhere
May 12, 2026
Merged

fix(php-tests): make coverage opt-in; install pcov by default#8
kojiromike merged 1 commit into
mainfrom
kojiromike/install-coverage-driver-everywhere

Conversation

@kojiromike
Copy link
Copy Markdown
Contributor

Summary

The previous php-tests.yml design split the matrix into a coverage entry (xdebug) and test entries (no driver). Projects whose phpunit.xml declares a <coverage> block (like oce-module-sinch-conversations) tripped "No code coverage driver available" warnings on the test entries, which PHPUnit then exits 1 on.

This PR:

  • Installs pcov on every matrix entry by default (configurable via coverage-driver — set 'none' to skip, 'xdebug' for branch coverage). Pcov satisfies PHPUnit's <coverage> block requirement with negligible runtime overhead.
  • Makes coverage collection opt-in rather than the default. coverage-php-version now defaults to '' (empty / disabled). Set it to a PHP version to designate one matrix entry that runs coverage-command and uploads the HTML artifact.

Behavior change

Existing callers no longer produce the coverage HTML artifact by default. None of the current OCE modules consume that artifact (no Codecov upload, no GitHub UI surface), so the practical impact is zero. Callers that want the artifact back set coverage-php-version: '8.2' (or similar) in their with: block.

Test plan

  • actionlint clean
  • After merge + tag: bump pin in oce-module-sinch-conversations#132 and confirm tests pass on all matrix entries

Closes the test failures on openCoreEMR/oce-module-sinch-conversations#132.

The previous design split the matrix into a coverage entry (xdebug) and
test entries (no driver). Projects whose phpunit.xml declares a
<coverage> block — like oce-module-sinch-conversations — were tripping
"No code coverage driver available" warnings on the test entries,
which exit 1.

Now the reusable installs pcov on every matrix entry (configurable via
coverage-driver) so the warning never fires, and runs test-script on
every entry by default. Coverage collection becomes opt-in: set
coverage-php-version to a non-empty PHP version to designate one matrix
entry that runs coverage-command and uploads the HTML artifact.

Behavior change for existing callers: coverage HTML artifact is no
longer produced by default. None of the current OCE modules consume
that artifact, so the impact is zero. Callers that want it back set
coverage-php-version explicitly.
@kojiromike kojiromike force-pushed the kojiromike/install-coverage-driver-everywhere branch from e39d0fe to 16f130f Compare May 12, 2026 13:47
@kojiromike kojiromike merged commit 1c845d1 into main May 12, 2026
1 check passed
@kojiromike kojiromike deleted the kojiromike/install-coverage-driver-everywhere branch May 12, 2026 13:51
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