Skip to content

Commit ade581e

Browse files
authored
Merge pull request #15 from Aeliot-Tm/matrix
Configure matrix for better dependencies testing
2 parents 09e93af + c1d64c0 commit ade581e

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,41 @@ permissions:
77
contents: read
88

99
jobs:
10-
build:
11-
10+
phpunit:
1211
runs-on: ubuntu-latest
12+
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-version:
17-
- '7.1'
18-
- '7.4'
19-
- '8.0'
20-
- '8.1'
2116
include:
2217
- php-version: '7.1'
18+
symfony-version: '3.4.*'
19+
phpunit-version: '7.5.20'
2320
- php-version: '7.4'
21+
symfony-version: '4.0.*'
22+
phpunit-version: '9.5.28'
2423
- php-version: '8.0'
24+
symfony-version: '5.0.*'
25+
phpunit-version: '9.5.28'
26+
- php-version: '8.1'
27+
symfony-version: '6.0.*'
28+
phpunit-version: '9.5.28'
2529
- php-version: '8.1'
30+
symfony-version: '^6.2'
31+
phpunit-version: '9.5.28'
2632

2733
steps:
34+
- uses: "shivammathur/setup-php@v2"
35+
with:
36+
php-version: "${{ matrix.php-version }}"
37+
2838
- uses: actions/checkout@v3
2939

40+
- name: Set versions
41+
run: |
42+
sed -i 's/\^3.4|\^4.0|\^5.0|\^6.0/${{ matrix.symfony-version }}/g' composer.json
43+
sed -i 's/\^7.5|\^9.5/${{ matrix.phpunit-version }}/g' composer.json
44+
3045
- name: Validate composer.json and composer.lock
3146
run: composer validate --strict
3247

@@ -40,13 +55,31 @@ jobs:
4055
${{ runner.os }}-php-
4156
4257
- name: Install dependencies
43-
run: composer install --prefer-dist --no-progress
44-
45-
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
46-
# Docs: https://getcomposer.org/doc/articles/scripts.md
58+
uses: ramsey/composer-install@v2
4759

4860
- name: Run test suite
4961
run: composer run-script test
5062

63+
phpstan:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: "shivammathur/setup-php@v2"
67+
with:
68+
php-version: "7.4"
69+
70+
- uses: actions/checkout@v3
71+
72+
- name: Cache Composer packages
73+
id: composer-cache
74+
uses: actions/cache@v3
75+
with:
76+
path: vendor
77+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
78+
restore-keys: |
79+
${{ runner.os }}-php-
80+
81+
- name: Install dependencies
82+
uses: ramsey/composer-install@v2
83+
5184
- name: PHPStan analyse
5285
run: vendor/bin/phpstan analyse

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
],
2626
"config": {
2727
"allow-plugins": {
28+
"ocramius/package-versions": true,
2829
"phpstan/extension-installer": true
2930
},
3031
"sort-packages": true
@@ -40,7 +41,7 @@
4041
"phpstan/extension-installer": "*",
4142
"phpstan/phpstan": "*",
4243
"phpstan/phpstan-phpunit": "*",
43-
"phpunit/phpunit": "*,<10.0"
44+
"phpunit/phpunit": "^7.5|^9.5"
4445
},
4546
"scripts": {
4647
"test": "vendor/bin/phpunit",

0 commit comments

Comments
 (0)