From 71c513b1b5c89c53d5fac267570ddf3761226d96 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 21 Apr 2021 19:49:50 +0200 Subject: [PATCH] Create code coverage during the CI builds The code coverage is only created for one PHP version (the highest version) per build as there is no point to have multiple code coverage uploads for the same code change. --- .github/workflows/ci.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de812382..a6904426 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,16 +39,11 @@ jobs: strategy: fail-fast: false matrix: - php-version: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 + php-version: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3' ] + coverage: [ 'none' ] + include: + - php-version: 7.4 + coverage: xdebug steps: - name: Checkout @@ -59,7 +54,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer:v2 - coverage: none + coverage: "${{ matrix.coverage }}" - name: Cache dependencies installed with composer uses: actions/cache@v1 @@ -75,4 +70,11 @@ jobs: composer show; - name: Run Tests - run: ./vendor/bin/phpunit + run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml + + - name: Upload coverage results to Coveralls + if: "${{ matrix.coverage != 'none' }}" + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + run: | + ./vendor/bin/codacycoverage clover build/coverage/xml