Download the PHP package orbeji/phpunit-pr-coverage-check without Composer
On this page you can find all versions of the php package orbeji/phpunit-pr-coverage-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download orbeji/phpunit-pr-coverage-check
More information about orbeji/phpunit-pr-coverage-check
Files in orbeji/phpunit-pr-coverage-check
Package phpunit-pr-coverage-check
Short Description Check the code coverage of a PR using the clover report of phpunit
License MIT
Informations about the package phpunit-pr-coverage-check
Phpunit PR Coverage Check
About The Project
Inspired by https://github.com/richardregeer/phpunit-coverage-check
This project is a console command that filters the coverage report of your Phpunit tests to only take into account the modifications of a PullRequest, so you can be sure that the PR has enough tests.
(back to top)
Getting Started
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
Usage
There are two ways of using this command:
- Passing a diff file
- Passing git repo information
With the first option you need to generate the appropiate diff file to pass to the command.
The diff file must only contain the modified files/lines of the pr. To do that you can call
git diff DESTINATION_BRANCH...PR_BRANCH > diff.txt
with
Bitbucket and
GitHub
you have environment variables to know
the current and destination branches.
Diff file example: Bitbucket
GitHub
Git repo information
The API token must have permissions to the PullRequest scope.
For GitHub in the workspace option put the owner of the repo.
In any case if the coverage is not met the command will return the covered percentage
Reports
When executing the command line you can pass the option --report
to generate a table with the uncovered lines of the PR
This option accepts 3 values:
- ansi: Coverage table in console output
- comment: Coverage table in PR comment
- report: Bitbucket report
Examples:
ansi:
comment: report:
CI Integration
Bitbucket Pipelines
GitHub Actions
Roadmap
- [ ] Add Bitbucket report example screenshot
- [x] Add examples of CI for Bitbucket and GitHub
See the open issues for a full list of proposed features (and known issues).
(back to top)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate and that all the GitHub Actions are passing.
(back to top)
License
Distributed under the MIT License.
(back to top)
Contact
Project Link: https://github.com/orbeji/phpunit-pr-coverage-check
(back to top)
All versions of phpunit-pr-coverage-check with dependencies
ext-json Version *
ext-simplexml Version *
composer-runtime-api Version ^2.2
mashape/unirest-php Version ^3.0
ptlis/diff-parser Version ^1.0.2
symfony/console Version ^5.4.36
symfony/polyfill-php83 Version *
symfony/polyfill-uuid Version ^1.29.0