Skip to content

Commit 83ccf6e

Browse files
authored
[TASK] Move the coverage generation to a separate CI workflow (#427)
1 parent 49df8dd commit 83ccf6e

File tree

2 files changed

+59
-13
lines changed

2 files changed

+59
-13
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ jobs:
4242
fail-fast: false
4343
matrix:
4444
php-version: [ '7.2', '7.3' ]
45-
coverage: [ 'none' ]
46-
include:
47-
- php-version: '7.4'
48-
coverage: xdebug
4945

5046
steps:
5147
- name: Checkout
@@ -57,7 +53,7 @@ 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
6157

6258
- name: Show the Composer configuration
6359
run: composer config --global --list
@@ -76,14 +72,7 @@ jobs:
7672
composer show;
7773
7874
- name: Run Tests
79-
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
80-
81-
- name: Upload coverage results to Codacy
82-
env:
83-
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
84-
if: "${{ matrix.coverage != 'none' && env.CODACY_PROJECT_TOKEN != '' }}"
85-
run: |
86-
./vendor/bin/codacycoverage clover build/coverage/xml
75+
run: ./vendor/bin/phpunit
8776

8877
static-analysis:
8978
name: Static Analysis

.github/workflows/codecoverage.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
name: Code coverage
10+
11+
jobs:
12+
code-coverage:
13+
name: Code coverage
14+
15+
runs-on: ubuntu-22.04
16+
17+
strategy:
18+
matrix:
19+
php-version: [ '7.4' ]
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php-version }}
29+
ini-values: error_reporting=E_ALL
30+
tools: composer:v2
31+
coverage: xdebug
32+
33+
- name: Show the Composer configuration
34+
run: composer config --global --list
35+
36+
- name: Cache dependencies installed with composer
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.cache/composer
40+
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
41+
restore-keys: |
42+
php${{ matrix.php-version }}-composer-
43+
44+
- name: Install Composer dependencies
45+
run: |
46+
composer update --with-dependencies --no-progress;
47+
composer show;
48+
49+
- name: Run Tests
50+
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml
51+
52+
- name: Upload coverage results to Codacy
53+
env:
54+
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
55+
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
56+
run: |
57+
./vendor/bin/codacycoverage clover build/coverage/xml

0 commit comments

Comments
 (0)