Skip to content

Report coverage and test results for GitHub Actions runs #1730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: v2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ inputs.php-version }}
extensions: "mongodb-${{ inputs.driver-version }}"
extensions: "xdebug,mongodb-${{ inputs.driver-version }}"
key: "extcache-${{ inputs.driver-version }}"

- name: Cache extensions
Expand All @@ -37,7 +37,7 @@ runs:
uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: "mongodb-${{ inputs.driver-version }}"
extensions: "xdebug,mongodb-${{ inputs.driver-version }}"
php-version: "${{ inputs.php-version }}"
tools: cs2pr
ini-values: "${{ inputs.php-ini-values }}"
Expand Down
49 changes: 34 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,38 @@ jobs:
fail-fast: true
matrix:
os:
- "ubuntu-22.04"
- "ubuntu-24.04"
php-version:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
mongodb-version:
- "6.0"
- "8.0"
topology:
- "server"
- "replica_set"
include:
# Test additional topologies for MongoDB 8.0
- os: "ubuntu-24.04"
php-version: "8.4"
mongodb-version: "8.0"
topology: "server"
- os: "ubuntu-24.04"
php-version: "8.4"
mongodb-version: "8.0"
topology: "sharded_cluster"
# Test lowest server/php versions
- os: "ubuntu-22.04"
php-version: "8.1"
mongodb-version: "6.0"
topology: "replica_set"
topology: "server"
- os: "ubuntu-22.04"
php-version: "8.1"
mongodb-version: "6.0"
topology: "sharded_cluster"
- os: "ubuntu-24.04"
php-version: "8.1"
mongodb-version: "8.0"
topology: "server"
- os: "ubuntu-24.04"
php-version: "8.1"
mongodb-version: "8.0"
topology: "replica_set"
- os: "ubuntu-24.04"
- os: "ubuntu-22.04"
php-version: "8.1"
mongodb-version: "8.0"
mongodb-version: "6.0"
topology: "sharded_cluster"

steps:
Expand Down Expand Up @@ -81,6 +83,23 @@ jobs:
php-ini-values: "zend.assertions=1"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit"
run: "vendor/bin/phpunit --configuration phpunit.evergreen.xml --coverage-clover coverage.xml"
env:
XDEBUG_MODE: "coverage"
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }}

- name: "Upload coverage report"
uses: codecov/codecov-action@v5
with:
disable_search: true
files: coverage.xml
flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}"
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
disable_search: true
files: test-results.xml
flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}"
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions phpunit.evergreen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
</testsuite>
</testsuites>

<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>

<logging>
<junit outputFile="test-results.xml" />
</logging>
Expand Down
Loading