umbrellio / coverspector
This package helps to check that code coverage above minimum value. It can be useful in CI or git hooks.
Installs: 16 521
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: ^7.2|^7.3|^7.4|^8.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^8.4|^9.0
- umbrellio/code-style-php: ^1.0
README
This package helps to check that code coverage above minimum value. It can be useful in CI or git hooks.
Features
- Fail CI/hook when code coverage is less than minimal value.
- Print list of uncovered files
Installation
Run this command to install:
composer require umbrellio/coverspector
Usage
Allow coverage toll to print info about uncovered files. In case of phpunit, add to phpunit config:
addUncoveredFilesFromWhitelist="true"
In case of codeception:
show_uncovered: true
In your CI, dump coverage output into file
vendor/bin/codecept run --coverage | tee coverage.txt
Than, run coverspector with minimum code coverage value
vendor/bin/coverspector --file=coverage.txt --min=100
If coverage will be less, coverspector will fail the job and print list of all not totaly covered files
CI Coverage Artifacts
If you still want to save coverage report as CI artifact - you should set
when: on_failure
in your CI config.
License
Released under MIT License.
Authors
Created by Makin Vladislav.
Contributing
- Fork it ( https://github.com/umbrellio/coverspector )
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create new Pull Request