Skip to content

Commit

Permalink
Add coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati committed Jun 30, 2024
1 parent 5079455 commit 26e2fb3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -63,7 +65,7 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
coverage: ${{ matrix.coverage }}
extensions: intl
-
name: Checkout
Expand All @@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/composer.lock
/.php-cs-fixer.cache
/.phpunit.result.cache
/coverage.json
/coverage.xml
/php-coveralls.phar
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
9 changes: 9 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,13 @@
<directory>test/tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory>src</directory>
</include>
<exclude>
<directory>src/Build</directory>
<directory>src/data</directory>
</exclude>
</coverage>
</phpunit>

0 comments on commit 26e2fb3

Please sign in to comment.