Skip to content

Commit fcc8ae8

Browse files
committed
Report test results and coverage to codecov
1 parent fa35e1e commit fcc8ae8

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

.github/actions/setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ runs:
2323
uses: shivammathur/cache-extensions@v1
2424
with:
2525
php-version: ${{ inputs.php-version }}
26-
extensions: "mongodb-${{ inputs.driver-version }}"
26+
extensions: "xdebug,mongodb-${{ inputs.driver-version }}"
2727
key: "extcache-${{ inputs.driver-version }}"
2828

2929
- name: Cache extensions
@@ -37,7 +37,7 @@ runs:
3737
uses: shivammathur/setup-php@v2
3838
with:
3939
coverage: none
40-
extensions: "mongodb-${{ inputs.driver-version }}"
40+
extensions: "xdebug,mongodb-${{ inputs.driver-version }}"
4141
php-version: "${{ inputs.php-version }}"
4242
tools: cs2pr
4343
ini-values: "${{ inputs.php-ini-values }}"

.github/workflows/tests.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ jobs:
8383
php-ini-values: "zend.assertions=1"
8484

8585
- name: "Run PHPUnit"
86-
run: "vendor/bin/phpunit"
86+
run: "vendor/bin/phpunit --configuration phpunit.evergreen.xml"
8787
env:
88+
XDEBUG_MODE: "coverage"
8889
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }}
90+
91+
- name: "Upload coverage report"
92+
uses: codecov/codecov-action@v5
93+
with:
94+
disable_search: true
95+
files: coverage.xml
96+
flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}"
97+
token: ${{ secrets.CODECOV_TOKEN }}
98+
99+
- name: Upload test results to Codecov
100+
uses: codecov/test-results-action@v1
101+
with:
102+
disable_search: true
103+
files: test-results.xml
104+
flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}"
105+
token: ${{ secrets.CODECOV_TOKEN }}

phpunit.evergreen.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525
</testsuite>
2626
</testsuites>
2727

28+
<source>
29+
<include>
30+
<directory suffix=".php">src</directory>
31+
</include>
32+
</source>
33+
34+
<coverage>
35+
<report>
36+
<clover outputFile="coverage.xml" />
37+
</report>
38+
</coverage>
39+
2840
<logging>
2941
<junit outputFile="test-results.xml" />
3042
</logging>

0 commit comments

Comments
 (0)