Skip to content

Commit 33820dc

Browse files
committed
Add code coverage workflow
1 parent bf193c6 commit 33820dc

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update Code Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**.php"
9+
- "composer.json"
10+
- "composer.lock"
11+
- "phpunit.xml"
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
19+
20+
name: PHP ${{ matrix.php-version }}
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Set up Node.js
27+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
28+
with:
29+
node-version: "22"
30+
31+
- name: Set up PHP
32+
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a #2.33.0
33+
with:
34+
php-version: "7.4"
35+
36+
- name: Install npm dependencies
37+
run: npm ci
38+
39+
- name: Install Composer dependencies
40+
run: composer install --prefer-dist --no-interaction --no-progress
41+
42+
- name: Run wp-env and PHPUnit tests
43+
run: |
44+
npm run env:start
45+
npm run test:coverage
46+
47+
- name: Upload coverage to Codecov
48+
uses: codecov/codecov-action@v5
49+
with:
50+
files: ./coverage.xml
51+
fail_ci_if_error: true
52+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)