diff --git a/.github/workflows/phpunit.yaml b/.github/workflows/phpunit.yaml index f12a15d..f635507 100644 --- a/.github/workflows/phpunit.yaml +++ b/.github/workflows/phpunit.yaml @@ -21,6 +21,7 @@ jobs: with: php-version: ${{ env.PHP_VER }} tools: composer:v${{ env.COMPOSER_VER }} + coverage: pcov - name: Get Composer Cache Directory id: composer-cache @@ -38,5 +39,9 @@ jobs: run: | composer install - - name: Run PHPUnit - run: composer run phpunit \ No newline at end of file + - name: Tests coverage + uses: paambaati/codeclimate-action@v2.6.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + with: + coverageCommand: composer run phpunit-coverage diff --git a/README.md b/README.md index b57425c..2cf06d3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![UnitTests](https://github.com/renakdup/simple-wordpress-dic/actions/workflows/phpunit.yaml/badge.svg)](https://github.com/renakdup/simple-wordpress-dic/actions/workflows/phpunit.yaml) [![PHPStan](https://github.com/renakdup/simple-wordpress-dic/actions/workflows/phpstan.yaml/badge.svg)](https://github.com/renakdup/simple-wordpress-dic/actions/workflows/phpstan.yaml) [![PHP Version Require](http://poser.pugx.org/renakdup/simple-php-dic/require/php)](https://packagist.org/packages/renakdup/simple-php-dic) +[![Test Coverage](https://api.codeclimate.com/v1/badges/21ae6e3776b160b24e75/test_coverage)](https://codeclimate.com/github/renakdup/simple-php-dic/test_coverage) [![Dependents](http://poser.pugx.org/renakdup/simple-php-dic/dependents)](https://packagist.org/packages/renakdup/simple-php-dic) diff --git a/composer.json b/composer.json index 08499dd..3298535 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,8 @@ "symfony/var-dumper": "^5.4", "phpstan/phpstan": "^1.10", "phpstan/extension-installer": "^1.3", - "phpstan/phpstan-deprecation-rules": "^1.1" + "phpstan/phpstan-deprecation-rules": "^1.1", + "rregeer/phpunit-coverage-check": "^0.3.1" }, "autoload-dev": { "psr-4": { @@ -47,7 +48,8 @@ "phpcbf": "phpcbf --standard=./phpcs.xml", "phpstan": "phpstan analyse -c phpstan.neon", "phpstan.baselane": "phpstan analyse -c phpstan.neon --generate-baseline", - "phpunit": "phpunit" + "phpunit": "phpunit", + "phpunit-coverage": "phpunit --coverage-clover clover.xml" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 7b662b6..db5b0e1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0da7a08edb3ee3474c34900c506d9bd0", + "content-hash": "623d8c1ada154ed485262a50cc688861", "packages": [], "packages-dev": [ { @@ -884,6 +884,52 @@ ], "time": "2024-04-05T04:35:58+00:00" }, + { + "name": "rregeer/phpunit-coverage-check", + "version": "0.3.1", + "source": { + "type": "git", + "url": "https://github.com/richardregeer/phpunit-coverage-check.git", + "reference": "9618fa74477fbc448c1b0599bef5153d170094bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/richardregeer/phpunit-coverage-check/zipball/9618fa74477fbc448c1b0599bef5153d170094bd", + "reference": "9618fa74477fbc448c1b0599bef5153d170094bd", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "bin": [ + "bin/coverage-check" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Richard Regeer", + "email": "rich2309@gmail.com" + } + ], + "description": "Check the code coverage using the clover report of phpunit", + "keywords": [ + "ci", + "code coverage", + "php", + "phpunit", + "testing", + "unittest" + ], + "support": { + "issues": "https://github.com/richardregeer/phpunit-coverage-check/issues", + "source": "https://github.com/richardregeer/phpunit-coverage-check/tree/0.3.1" + }, + "time": "2019-10-14T07:04:13+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.2", diff --git a/phpunit.xml b/phpunit.xml index 0edb5c7..dd1f1b0 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,7 +8,7 @@ "> - / + ./src