Skip to content

DRAFT: GH Actions: Added support for code coverage with Coveralls.io #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- '7.1'
- '7.2'
- '7.3'
- '7.4'
# PHP 7.4 is tested in coverage section

steps:
- name: Checkout code
Expand All @@ -48,7 +48,38 @@ jobs:
run: ./vendor/bin/parallel-lint --exclude vendor . --exclude git . --checkstyle | cs2pr

- name: 'Run unit tests'
run: ./vendor/bin/phpunit
run: composer phpunit

- name: 'Check var dump on own code'
run: ./var-dump-check src

coverage:
needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: xdebug

- name: Install Composer dependencies - normal
uses: "ramsey/composer-install@v2"

- name: Run the unit tests with code coverage
run: composer coverage

- name: Install Coveralls
if: ${{ success() }}
run: composer require php-coveralls/php-coveralls:"^2.5.2" --no-interaction

- name: Upload coverage results to Coveralls
if: ${{ success() }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: vendor/bin/php-coveralls -v -x build/logs/clover.xml
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ or setting for ANT:
[![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)
[![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)
[![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)
[![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)
12 changes: 12 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,17 @@
"bin": ["var-dump-check"],
"replace": {
"jakub-onderka/php-var-dump-check": "*"
},
"scripts" : {
"phpunit": [
"@php ./vendor/phpunit/phpunit/phpunit --no-coverage"
],
"coverage": [
"@php ./vendor/phpunit/phpunit/phpunit"
]
},
"scripts-descriptions": {
"phpunit": "PHP unit",
"coverage": "PHP unit with code coverage"
}
}
45 changes: 33 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
<phpunit bootstrap="tests/bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.2/phpunit.xsd"
backupGlobals="true"
beStrictAboutTestsThatDoNotTestAnything="true"
bootstrap="./vendor/autoload.php"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="true"
stopOnFailure="false"
verbose="true"
>

<testsuites>
<testsuite name="Default tests">
<directory>tests</directory>
<testsuite name="PHP-Var-Dump-Check">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-html" target="build/coverage/"/>
<log type="coverage-text" target="php://stdout" showOnlySummary="true"/>
</logging>

<php>
<ini name="memory_limit" value="256M"/>
</php>
</phpunit>