Skip to content

Commit 5fc9288

Browse files
committed
CI: upload coverage to Codecov
Generate a clover report on one Drupal 11 job (pcov), upload it as an artifact, and send it to Codecov (non-blocking).
1 parent 020e57c commit 5fc9288

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/drupal-module.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ jobs:
2727
- drupal: "^10"
2828
php: "8.2"
2929
experimental: false
30+
coverage: false
3031
- drupal: "^11"
3132
php: "8.3"
3233
experimental: false
34+
coverage: true
3335
- drupal: "^11"
3436
php: "8.4"
3537
experimental: false
38+
coverage: false
3639
- drupal: "^11"
3740
php: "8.5"
3841
experimental: true
42+
coverage: false
3943

4044
env:
4145
SIMPLETEST_BASE_URL: "http://127.0.0.1"
@@ -49,6 +53,7 @@ jobs:
4953
php-version: "${{ matrix.php }}"
5054
tools: composer:v2
5155
extensions: gd
56+
coverage: pcov
5257

5358
- name: Create Drupal project
5459
run: composer create-project drupal/recommended-project:${{ matrix.drupal }} drupal --no-interaction --prefer-dist
@@ -75,6 +80,33 @@ jobs:
7580
chmod -R 777 drupal/web/sites/simpletest/browser_output
7681
7782
- name: Run PHPUnit
83+
if: ${{ !matrix.coverage }}
7884
run: |
7985
cd drupal/web
8086
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend/tests
87+
88+
- name: Run PHPUnit (coverage)
89+
if: ${{ matrix.coverage }}
90+
run: |
91+
cd drupal/web
92+
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend/tests \
93+
--coverage-clover "$GITHUB_WORKSPACE/coverage.xml" \
94+
--coverage-filter modules/contrib/jsonapi_frontend
95+
96+
- name: Upload coverage artifact
97+
if: ${{ matrix.coverage }}
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: coverage-jsonapi_frontend
101+
path: coverage.xml
102+
if-no-files-found: error
103+
104+
- name: Upload coverage to Codecov
105+
if: ${{ matrix.coverage }}
106+
continue-on-error: true
107+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
108+
with:
109+
files: coverage.xml
110+
flags: phpunit,drupal
111+
fail_ci_if_error: false
112+
verbose: true

0 commit comments

Comments
 (0)