Skip to content

Commit e1c642f

Browse files
committed
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.
1 parent c055c73 commit e1c642f

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,25 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php-version:
21-
- 5.3
22-
- 5.4
23-
- 5.5
24-
- 5.6
25-
- 7.0
26-
- 7.1
27-
- 7.2
28-
- 7.3
29-
- 7.4
20+
include:
21+
- php-version: 5.3
22+
coverage: none
23+
- php-version: 5.4
24+
coverage: none
25+
- php-version: 5.5
26+
coverage: none
27+
- php-version: 5.6
28+
coverage: none
29+
- php-version: 7.0
30+
coverage: none
31+
- php-version: 7.1
32+
coverage: none
33+
- php-version: 7.2
34+
coverage: none
35+
- php-version: 7.3
36+
coverage: none
37+
- php-version: 7.4
38+
coverage: xdebug
3039

3140
steps:
3241
- name: Checkout
@@ -37,7 +46,7 @@ jobs:
3746
with:
3847
php-version: ${{ matrix.php-version }}
3948
tools: composer:v2
40-
coverage: none
49+
coverage: "${{ matrix.coverage }}"
4150

4251
- name: Cache dependencies installed with composer
4352
uses: actions/cache@v1
@@ -53,4 +62,11 @@ jobs:
5362
composer show;
5463
5564
- name: Run Tests
56-
run: ./vendor/bin/phpunit
65+
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
66+
67+
- name: Upload coverage results to Coveralls
68+
if: "${{ matrix.coverage != 'none' }}"
69+
env:
70+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
71+
run: |
72+
./vendor/bin/codacycoverage clover build/coverage/xml

0 commit comments

Comments
 (0)