Skip to content

Commit ae31f00

Browse files
authored
Report coverage and test results for GitHub Actions runs (#1730)
* Refactor test pipeline on GitHub Actions * Report test results and coverage to codecov * Configure coverage reporting for GitHub Actions only * Fix xdebug coverage setup
1 parent 0058bc0 commit ae31f00

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ runs:
3636
- name: Install PHP
3737
uses: shivammathur/setup-php@v2
3838
with:
39-
coverage: none
39+
coverage: xdebug
4040
extensions: "mongodb-${{ inputs.driver-version }}"
4141
php-version: "${{ inputs.php-version }}"
4242
tools: cs2pr

.github/workflows/tests.yml

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,38 @@ jobs:
2323
fail-fast: true
2424
matrix:
2525
os:
26-
- "ubuntu-22.04"
26+
- "ubuntu-24.04"
2727
php-version:
2828
- "8.1"
2929
- "8.2"
3030
- "8.3"
3131
- "8.4"
3232
mongodb-version:
33-
- "6.0"
33+
- "8.0"
3434
topology:
35-
- "server"
35+
- "replica_set"
3636
include:
37+
# Test additional topologies for MongoDB 8.0
38+
- os: "ubuntu-24.04"
39+
php-version: "8.4"
40+
mongodb-version: "8.0"
41+
topology: "server"
42+
- os: "ubuntu-24.04"
43+
php-version: "8.4"
44+
mongodb-version: "8.0"
45+
topology: "sharded_cluster"
46+
# Test lowest server/php versions
3747
- os: "ubuntu-22.04"
3848
php-version: "8.1"
3949
mongodb-version: "6.0"
40-
topology: "replica_set"
50+
topology: "server"
4151
- os: "ubuntu-22.04"
4252
php-version: "8.1"
4353
mongodb-version: "6.0"
44-
topology: "sharded_cluster"
45-
- os: "ubuntu-24.04"
46-
php-version: "8.1"
47-
mongodb-version: "8.0"
48-
topology: "server"
49-
- os: "ubuntu-24.04"
50-
php-version: "8.1"
51-
mongodb-version: "8.0"
5254
topology: "replica_set"
53-
- os: "ubuntu-24.04"
55+
- os: "ubuntu-22.04"
5456
php-version: "8.1"
55-
mongodb-version: "8.0"
57+
mongodb-version: "6.0"
5658
topology: "sharded_cluster"
5759

5860
steps:
@@ -81,6 +83,23 @@ jobs:
8183
php-ini-values: "zend.assertions=1"
8284

8385
- name: "Run PHPUnit"
84-
run: "vendor/bin/phpunit"
86+
run: "vendor/bin/phpunit --configuration phpunit.evergreen.xml --coverage-clover coverage.xml"
8587
env:
88+
XDEBUG_MODE: "coverage"
8689
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
</testsuite>
2626
</testsuites>
2727

28+
<source>
29+
<include>
30+
<directory suffix=".php">src</directory>
31+
</include>
32+
</source>
33+
2834
<logging>
2935
<junit outputFile="test-results.xml" />
3036
</logging>

0 commit comments

Comments
 (0)