Skip to content

Commit

Permalink
[TASK] Move the coverage generation to a separate CI job
Browse files Browse the repository at this point in the history
This makes the CI configuration easier to understand.
  • Loading branch information
oliverklee committed Feb 2, 2024
1 parent 73b0344 commit 54aaec8
Showing 1 changed file with 46 additions and 7 deletions.
53 changes: 46 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,50 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '7.2', '7.3' ]
coverage: [ 'none' ]
include:
- php-version: '7.4'
coverage: xdebug
php-version: [ '7.2', '7.3', '7.4' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none

- name: Show the Composer configuration
run: composer config --global --list

- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ~/.cache/composer
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Install Composer dependencies
run: |
composer update --with-dependencies --no-progress;
composer show;
- name: Run Tests
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml

coverage:
name: Coverage

runs-on: ubuntu-22.04

needs: [ php-lint ]

strategy:
fail-fast: false
matrix:
php-version: [ '7.4' ]

steps:
- name: Checkout
Expand All @@ -55,7 +94,7 @@ jobs:
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: "${{ matrix.coverage }}"
coverage: xdebug

- name: Show the Composer configuration
run: composer config --global --list
Expand All @@ -79,7 +118,7 @@ jobs:
- name: Upload coverage results to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}"
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
run: |
./vendor/bin/codacycoverage clover build/coverage/xml
Expand Down

0 comments on commit 54aaec8

Please sign in to comment.