Skip to content

Commit 36067a5

Browse files
committed
Split test suites into unit and integration for separate coverage reporting in Codecov 🤠
1 parent 3fb233d commit 36067a5

2 files changed

Lines changed: 47 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,25 @@ jobs:
4545
- name: Install dependencies
4646
run: composer install --no-interaction --prefer-dist
4747

48-
- name: Run tests with coverage
49-
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml
48+
- name: Run unit tests with coverage
49+
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --testsuite unit --coverage-clover coverage-unit.xml
5050

51-
- name: Upload coverage to Codecov
51+
- name: Run integration tests with coverage
52+
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --testsuite integration --coverage-clover coverage-integration.xml
53+
54+
- name: Upload unit coverage to Codecov
55+
uses: codecov/codecov-action@v4
56+
with:
57+
files: coverage-unit.xml
58+
flags: unit
59+
env:
60+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
61+
62+
- name: Upload integration coverage to Codecov
5263
uses: codecov/codecov-action@v4
5364
with:
54-
files: coverage.xml
65+
files: coverage-integration.xml
66+
flags: integration
5567
env:
5668
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5769

codecov.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
codecov:
2+
require_ci_to_pass: true
3+
4+
coverage:
5+
status:
6+
project:
7+
default:
8+
target: auto
9+
threshold: 1%
10+
patch:
11+
default:
12+
target: 80%
13+
14+
flag_management:
15+
default_rules:
16+
carryforward: true
17+
individual_flags:
18+
- name: unit
19+
paths:
20+
- src/
21+
statuses:
22+
- type: project
23+
target: auto
24+
threshold: 1%
25+
- name: integration
26+
paths:
27+
- src/
28+
statuses:
29+
- type: project
30+
target: auto
31+
threshold: 1%

0 commit comments

Comments
 (0)