Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theomessin/action-phpcov
🩺 GitHub Action to turbocharge phpunit code coverage reporting.
https://github.com/theomessin/action-phpcov
actions coverage github php phpunit report
Last synced: 25 days ago
JSON representation
🩺 GitHub Action to turbocharge phpunit code coverage reporting.
- Host: GitHub
- URL: https://github.com/theomessin/action-phpcov
- Owner: theomessin
- Created: 2020-01-28T20:14:13.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T06:10:08.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T16:15:21.659Z (7 months ago)
- Topics: actions, coverage, github, php, phpunit, report
- Language: TypeScript
- Homepage: https://action-phpcov.now.sh/
- Size: 560 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## PHPCov GitHub Action
This action will produce a PHPUnit coverage HTML report, publish it using ZEIT Now, and enforce a minimum coverage level.
### Inputs
**`now_token`** __(required)__ Your ZEIT Now token - used to deploy reports.
**`now_project`** _(optional)_ Which ZEIT Now project to deploy reports to.
**`min_coverage`** _(optional)_ The minimum coverage to enforce (default is `50`).
**`phpunit`** _(optional)_ The phpunit command (default is `./vendor/bin/phpunit`).
### Outputs
**`url`** The deployment URL from ZEIT Now with the coverage report.
### Example usage
Here's how to use this action on a PHP project such as Laravel.
Assuming your repo has a `NOW_TOKEN` secret with your ZEIT Now token,
all you have to do is set up PHP (with a coverage driver),
as well as install composer dependencies.```yml
on: [push]jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@master
with:
coverage: pcov
php-version: '7.4'
extension: dom, fileinfo, mbstring
- run: |
composer install --no-suggest --prefer-dist --optimize-autoloader
php -r "file_exists('.env') || copy('.env.example', '.env');"
php artisan key:generate
- uses: theomessin/action-phpcov
with:
min_coverage: 35
now_project: "action-phpcov"
now_token: ${{ secrets.NOW_TOKEN }}
phpunit: "./vendor/bin/phpunit --testdox"
```This will output a message such as this:
```
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.Example (Tests\Unit\Example)
✔ Basic testExample (Tests\Feature\Example)
✔ Basic testTime: 160 ms, Memory: 18.00 MB
OK (2 tests, 2 assertions)
Generating code coverage report in Clover XML format ... done [10 ms]
Generating code coverage report in HTML format ... done [20 ms]
[Actual coverage is 44.23%. Minimum coverage is 35%]
▰▰▰▰▰▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱
You may find a full coverage report here:
https://action-phpcov.now.sh
```If the minimum coverage is not met, the action with fail.