Skip to content

Commit fb15543

Browse files
committed
GH Actions: Added support for code coverage with Coveralls.io
1 parent fb0bf7f commit fb15543

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.github/workflows/test.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- '7.1'
2828
- '7.2'
2929
- '7.3'
30-
- '7.4'
30+
# PHP 7.4 is tested in coverage section
3131

3232
steps:
3333
- name: Checkout code
@@ -52,3 +52,34 @@ jobs:
5252

5353
- name: 'Check var dump on own code'
5454
run: ./var-dump-check src
55+
56+
coverage:
57+
needs: test
58+
runs-on: ubuntu-latest
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v2
63+
64+
- name: Setup PHP
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: '7.4'
68+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
69+
coverage: xdebug
70+
71+
- name: Install Composer dependencies - normal
72+
uses: "ramsey/composer-install@v2"
73+
74+
- name: Run the unit tests with code coverage
75+
run: ./vendor/bin/phpunit
76+
77+
- name: Install Coveralls
78+
if: ${{ success() }}
79+
run: composer require php-coveralls/php-coveralls:"^2.5.2" --no-interaction
80+
81+
- name: Upload coverage results to Coveralls
82+
if: ${{ success() }}
83+
env:
84+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
run: vendor/bin/php-coveralls -v -x build/logs/clover.xml

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ or setting for ANT:
8282
[![Build Status](https://github.com/php-parallel-lint/PHP-Var-Dump-Check/actions/workflows/test.yml/badge.svg)](https://github.com/php-parallel-lint/PHP-Var-Dump-Check/actions/workflows/test.yml)
8383
[![Downloads this Month](https://img.shields.io/packagist/dm/php-parallel-lint/php-var-dump-check.svg)](https://packagist.org/packages/php-parallel-lint/php-var-dump-check)
8484
[![Latest stable](https://img.shields.io/packagist/v/php-parallel-lint/php-var-dump-check.svg)](https://packagist.org/packages/php-parallel-lint/php-var-dump-check)
85+
[![Coverage Status](https://coveralls.io/repos/github/php-parallel-lint/php-var-dump-check/badge.svg?branch=master)](https://coveralls.io/github/php-parallel-lint/php-var-dump-check?branch=master)

0 commit comments

Comments
 (0)