Skip to content

Commit 40e81d4

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 1eddd08 commit 40e81d4

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
@@ -80,6 +85,33 @@ jobs:
8085
chmod -R 777 drupal/web/sites/simpletest/browser_output
8186
8287
- name: Run PHPUnit
88+
if: ${{ !matrix.coverage }}
8389
run: |
8490
cd drupal/web
8591
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend_layout/tests
92+
93+
- name: Run PHPUnit (coverage)
94+
if: ${{ matrix.coverage }}
95+
run: |
96+
cd drupal/web
97+
../vendor/bin/phpunit -c core modules/contrib/jsonapi_frontend_layout/tests \
98+
--coverage-clover "$GITHUB_WORKSPACE/coverage.xml" \
99+
--coverage-filter modules/contrib/jsonapi_frontend_layout
100+
101+
- name: Upload coverage artifact
102+
if: ${{ matrix.coverage }}
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: coverage-jsonapi_frontend_layout
106+
path: coverage.xml
107+
if-no-files-found: error
108+
109+
- name: Upload coverage to Codecov
110+
if: ${{ matrix.coverage }}
111+
continue-on-error: true
112+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
113+
with:
114+
files: coverage.xml
115+
flags: phpunit,drupal
116+
fail_ci_if_error: false
117+
verbose: true

0 commit comments

Comments
 (0)