fix(php-tests): make coverage opt-in; install pcov by default#8
Merged
Merged
Conversation
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.
e39d0fe to
16f130f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The previous
php-tests.ymldesign split the matrix into a coverage entry (xdebug) and test entries (no driver). Projects whosephpunit.xmldeclares 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:
coverage-driver— set'none'to skip,'xdebug'for branch coverage). Pcov satisfies PHPUnit's<coverage>block requirement with negligible runtime overhead.coverage-php-versionnow defaults to''(empty / disabled). Set it to a PHP version to designate one matrix entry that runscoverage-commandand 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 theirwith:block.Test plan
Closes the test failures on openCoreEMR/oce-module-sinch-conversations#132.