From 415e8fd4a15d03c820eb1cdcc7d1d1dbd08b5d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Make=C5=A1?= Date: Fri, 11 Feb 2022 12:14:48 +0100 Subject: [PATCH 1/4] Updated PHPUnit xml configuration --- phpunit.xml.dist | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 154f6ee..0fc786f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,18 +1,21 @@ - + + + tests - From e4810c6c0b0f2bb961c28adcc2f11dcb58e31fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Make=C5=A1?= Date: Fri, 11 Feb 2022 12:15:12 +0100 Subject: [PATCH 2/4] Added settings for track code coverage Used composer scripts as easy and no-repeated command configuration. --- .github/workflows/test.yml | 2 +- composer.json | 12 ++++++++++++ phpunit.xml.dist | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d64b985..b796715 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,7 +48,7 @@ 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 diff --git a/composer.json b/composer.json index 412752e..51c000f 100644 --- a/composer.json +++ b/composer.json @@ -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" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0fc786f..b14d97e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,6 +13,12 @@ processIsolation="false" stopOnFailure="false"> + + + + + + tests From bbbd527e1fdd19f179dbe4dc6abce52d70acea10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Make=C5=A1?= Date: Fri, 11 Feb 2022 11:49:49 +0100 Subject: [PATCH 3/4] GH Actions: Added support for code coverage with Coveralls.io --- .github/workflows/test.yml | 33 ++++++++++++++++++++++++++++++++- README.md | 1 + 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b796715..bddc421 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -52,3 +52,34 @@ jobs: - 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 diff --git a/README.md b/README.md index f5dad38..94cccda 100644 --- a/README.md +++ b/README.md @@ -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) From e86a441326d337d30a47c854b43bdfd3b83e8108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Make=C5=A1?= Date: Fri, 11 Feb 2022 12:54:42 +0100 Subject: [PATCH 4/4] wip --- phpunit.xml.dist | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b14d97e..e965e1a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,31 @@ - + + 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" +> + + + + tests + + + + + + src + + @@ -19,9 +33,7 @@ - - - tests - - + + +