diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fad74c2..ead50ca 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,6 +40,8 @@ jobs: - os: ubuntu-latest php-version: "8.0" + coverage: xdebug + phpunit-options: --coverage-clover coverage.xml - os: ubuntu-latest php-version: "8.1" @@ -63,7 +65,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - coverage: none + coverage: ${{ matrix.coverage }} extensions: intl - name: Checkout @@ -73,4 +75,14 @@ jobs: run: composer update --ansi --no-interaction --no-progress - name: Run PHPUnit - run: composer run-script test --ansi --no-interaction + run: composer run-script test --ansi --no-interaction -- ${{ matrix.phpunit-options }} + - + name: Download Coveralls + if: matrix.coverage + run: curl -sSLf -o php-coveralls.phar https://github.com/php-coveralls/php-coveralls/releases/download/v2.7.0/php-coveralls.phar + - + name: Upload coverage + if: matrix.coverage + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: php php-coveralls.phar --ansi --no-interaction --coverage_clover=coverage.xml --json_path=coverage.json -v diff --git a/.gitignore b/.gitignore index 5c0f0a3..0a383d6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ /composer.lock /.php-cs-fixer.cache /.phpunit.result.cache +/coverage.json +/coverage.xml +/php-coveralls.phar diff --git a/README.md b/README.md index 66b9169..8a81f48 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Tests](https://github.com/mlocati/comuni-italiani/actions/workflows/tests.yml/badge.svg)](https://github.com/mlocati/comuni-italiani/actions/workflows/tests.yml) +[![Coverage](https://coveralls.io/repos/github/mlocati/comuni-italiani/badge.svg?branch=main)](https://coveralls.io/github/mlocati/comuni-italiani?branch=main) ## Comuni Italiani diff --git a/phpunit.xml b/phpunit.xml index 533b070..49beeef 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -13,4 +13,13 @@ test/tests + + + src + + + src/Build + src/data + +