Skip to content

Commit 3f40955

Browse files
committed
ci: enhance PHP workflow with matrix strategy and coverage reporting
1 parent 918b8ea commit 3f40955

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/php.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,31 @@ permissions:
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
php-versions: ['8.1', '8.2', '8.3', '8.4']
18+
fail-fast: false
19+
20+
name: PHP ${{ matrix.php-versions }} Test
1621

1722
steps:
18-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
1924

20-
- name: Setup PHP with PECL extension
25+
- name: Setup PHP
2126
uses: shivammathur/setup-php@v2
2227
with:
23-
php-version: '8.3'
28+
php-version: ${{ matrix.php-versions }}
29+
tools: composer:v2
30+
coverage: xdebug
31+
continue-on-error: ${{ matrix.php-versions == '8.4' }}
2432

2533
- name: Validate composer.json and composer.lock
2634
run: composer validate --strict
2735

2836
- name: Cache Composer packages
2937
id: composer-cache
30-
uses: actions/cache@v3
38+
uses: actions/cache@v4
3139
with:
3240
path: vendor
3341
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
@@ -38,4 +46,11 @@ jobs:
3846
run: composer install --no-interaction --prefer-dist --no-progress
3947

4048
- name: Run test suite
41-
run: composer run-script test
49+
run: vendor/bin/phpunit --coverage-clover=coverage.xml --log-junit junit.xml
50+
51+
- name: Upload coverage reports
52+
uses: codecov/codecov-action@v4
53+
if: ${{ matrix.php-versions == '8.3' }}
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
files: ./coverage.xml

0 commit comments

Comments
 (0)