Skip to content

Commit 87a61db

Browse files
committed
[TASK] Move the coverage generation to a separate CI job
This makes the CI configuration easier to understand.
1 parent 73b0344 commit 87a61db

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,50 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
php-version: [ '7.2', '7.3' ]
43-
coverage: [ 'none' ]
44-
include:
45-
- php-version: '7.4'
46-
coverage: xdebug
42+
php-version: [ '7.2', '7.3', '7.4' ]
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Install PHP
49+
uses: shivammathur/setup-php@v2
50+
with:
51+
php-version: ${{ matrix.php-version }}
52+
ini-values: error_reporting=E_ALL
53+
tools: composer:v2
54+
coverage: none
55+
56+
- name: Show the Composer configuration
57+
run: composer config --global --list
58+
59+
- name: Cache dependencies installed with composer
60+
uses: actions/cache@v4
61+
with:
62+
path: ~/.cache/composer
63+
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
64+
restore-keys: |
65+
php${{ matrix.php-version }}-composer-
66+
67+
- name: Install Composer dependencies
68+
run: |
69+
composer update --with-dependencies --no-progress;
70+
composer show;
71+
72+
- name: Run Tests
73+
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
74+
75+
coverage:
76+
name: Unit tests
77+
78+
runs-on: ubuntu-22.04
79+
80+
needs: [ php-lint ]
81+
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
php-version: [ '7.4' ]
4786

4887
steps:
4988
- name: Checkout
@@ -55,7 +94,7 @@ jobs:
5594
php-version: ${{ matrix.php-version }}
5695
ini-values: error_reporting=E_ALL
5796
tools: composer:v2
58-
coverage: "${{ matrix.coverage }}"
97+
coverage: xdebug
5998

6099
- name: Show the Composer configuration
61100
run: composer config --global --list
@@ -79,7 +118,7 @@ jobs:
79118
- name: Upload coverage results to Codacy
80119
env:
81120
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
82-
if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}"
121+
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
83122
run: |
84123
./vendor/bin/codacycoverage clover build/coverage/xml
85124

0 commit comments

Comments
 (0)