Skip to content

Commit 0bd9bcf

Browse files
authored
Merge pull request #10 from hans-thomas/php-matrix-workflow
PHP matrix added to workflow to run tests on different environments.
2 parents eaf79b9 + 805a9e6 commit 0bd9bcf

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

.github/workflows/php.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
name: PHP Composer
22

3-
on:
4-
push:
5-
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
3+
on: [push, pull_request]
84

95
permissions:
106
contents: read
117

128
jobs:
139
build:
1410

15-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ ubuntu-latest ]
16+
php: [ 8.1, 8.2, 8.3 ]
17+
dependency-version: [ prefer-stable ]
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}
1620

1721
steps:
18-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
1923

2024
- name: Setup PHP
2125
uses: shivammathur/setup-php@v2
2226
with:
23-
php-version: '8.1'
27+
php-version: ${{ matrix.php }}
2428
extensions: xdebug
2529
ini-values: xdebug.mode="coverage"
2630
coverage: xdebug
2731

2832
- name: Validate composer.json and composer.lock
2933
run: composer validate --strict
3034

31-
- name: Cache Composer packages
35+
- name: Get Composer cache directory
3236
id: composer-cache
37+
run: |
38+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
39+
40+
- name: Cache Composer packages
3341
uses: actions/cache@v3
3442
with:
35-
path: vendor
36-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
37-
restore-keys: |
38-
${{ runner.os }}-php-
43+
path: ${{ steps.composer-cache.outputs.dir }}
44+
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
3945

4046
- name: Install dependencies
4147
run: composer install --prefer-dist --no-progress
@@ -48,6 +54,4 @@ jobs:
4854
with:
4955
token: ${{ secrets.CODECOV_TOKEN }}
5056
files: ./coverage.xml
51-
flags: unittests
52-
name: starter-codecov
5357
fail_ci_if_error: true

0 commit comments

Comments
 (0)