From f645fb6d0612c327c4117f37dfc60bd8a40df6fe Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 21 Jan 2025 12:30:28 +0100 Subject: [PATCH] PHPUnit: add clover code coverage config to config file This moves the clover code coverage config from the composer script to the `phpunit[10].xml.dist` config files. It also moves the default location for the file from the project root to the `tests/coverage/` directory so all coverage files are in the same place (and automatically git ignored etc). Includes updating the "upload to CodeCov" step to find the file in the new location. --- .github/workflows/test.yml | 6 +++--- phpunit.xml.dist | 1 + phpunit10.xml.dist | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd80805df..18cbfb98b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -123,11 +123,11 @@ jobs: - name: Run the unit tests with code coverage (PHPUnit < 10) if: ${{ matrix.coverage == true && ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }} - run: composer coverage -- --coverage-clover clover.xml + run: composer coverage - name: Run the unit tests with code coverage (PHPUnit 10+) if: ${{ matrix.coverage == true && startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }} - run: composer coverage10 -- --coverage-clover clover.xml + run: composer coverage10 - name: Stop proxy server continue-on-error: true @@ -144,6 +144,6 @@ jobs: uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 with: token: "${{ secrets.CODECOV_TOKEN }}" - files: ./clover.xml + files: ./tests/coverage/clover.xml fail_ci_if_error: true verbose: true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 854fb0950..8425042d5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -17,6 +17,7 @@ + diff --git a/phpunit10.xml.dist b/phpunit10.xml.dist index 8826f5bfe..825e177ec 100644 --- a/phpunit10.xml.dist +++ b/phpunit10.xml.dist @@ -31,6 +31,7 @@ +