Skip to content

Commit 88aadf3

Browse files
committed
[TASK] Move the coverage generation to a separate CI job
This makes the CI configuration easier to understand.
1 parent 49df8dd commit 88aadf3

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
@@ -41,11 +41,7 @@ jobs:
4141
strategy:
4242
fail-fast: false
4343
matrix:
44-
php-version: [ '7.2', '7.3' ]
45-
coverage: [ 'none' ]
46-
include:
47-
- php-version: '7.4'
48-
coverage: xdebug
44+
php-version: [ '7.2', '7.3', '7.4' ]
4945

5046
steps:
5147
- name: Checkout
@@ -57,7 +53,50 @@ jobs:
5753
php-version: ${{ matrix.php-version }}
5854
ini-values: error_reporting=E_ALL
5955
tools: composer:v2
60-
coverage: "${{ matrix.coverage }}"
56+
coverage: none
57+
58+
- name: Show the Composer configuration
59+
run: composer config --global --list
60+
61+
- name: Cache dependencies installed with composer
62+
uses: actions/cache@v4
63+
with:
64+
path: ~/.cache/composer
65+
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
66+
restore-keys: |
67+
php${{ matrix.php-version }}-composer-
68+
69+
- name: Install Composer dependencies
70+
run: |
71+
composer update --with-dependencies --no-progress;
72+
composer show;
73+
74+
- name: Run Tests
75+
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
76+
77+
coverage:
78+
name: Coverage
79+
80+
runs-on: ubuntu-22.04
81+
82+
needs: [ php-lint ]
83+
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
php-version: [ '7.4' ]
88+
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Install PHP
94+
uses: shivammathur/setup-php@v2
95+
with:
96+
php-version: ${{ matrix.php-version }}
97+
ini-values: error_reporting=E_ALL
98+
tools: composer:v2
99+
coverage: xdebug
61100

62101
- name: Show the Composer configuration
63102
run: composer config --global --list
@@ -81,7 +120,7 @@ jobs:
81120
- name: Upload coverage results to Codacy
82121
env:
83122
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
84-
if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}"
123+
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
85124
run: |
86125
./vendor/bin/codacycoverage clover build/coverage/xml
87126

0 commit comments

Comments
 (0)