9
9
jobs :
10
10
phpstan :
11
11
runs-on : ubuntu-latest
12
+ # define every php version to test
13
+ strategy :
14
+ # do not stop at first fail
15
+ fail-fast : false
16
+ matrix :
17
+ php : [7.4, 8.2]
18
+
12
19
steps :
13
20
- uses : actions/checkout@v4
14
21
15
- - name : Setup PHP 7.4 for dependencies
22
+ - name : Setup PHP ${{ matrix.php }} for dependencies
16
23
uses : shivammathur/setup-php@v2
17
24
with :
18
- php-version : 7.4
25
+ php-version : ${{ matrix.php }}
19
26
20
27
- name : Install Dependencies
21
28
run : composer update --ignore-platform-reqs
22
29
23
- - name : Setup PHP 8.2 for PHPStan
24
- uses : shivammathur/setup-php@v2
25
- with :
26
- php-version : 8.2
27
-
28
30
- name : Restore PHPStan cache
29
31
id : cache-phpstan
30
32
uses : actions/cache/restore@v3
31
33
with :
32
34
path : phpstan.phar
33
35
key : phpstan-1
34
36
35
- - name : Download PHPStan
36
- if : steps.cache-phpstan.outputs.cache-hit != 'true'
37
- run : wget https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar
38
-
39
37
- name : Run PHPStan
40
- run : php phpstan.phar analyse --configuration phpstan.neon
38
+ run : vendor/bin/ phpstan analyse --configuration phpstan.neon
41
39
42
40
update-baseline :
43
41
needs : phpstan
50
48
51
49
- name : Delete existing branch if exists
52
50
run : |
53
- if git ls-remote --heads origin update-phpstan-baseline | grep update-phpstan-baseline; then
54
- git push origin --delete update-phpstan-baseline
55
- fi
51
+ git ls-remote --exit-code --heads origin update-phpstan-baseline && git push origin --delete update-phpstan-baseline
56
52
57
53
- name : Setup PHP 7.4 for dependencies
58
54
uses : shivammathur/setup-php@v2
@@ -62,19 +58,11 @@ jobs:
62
58
- name : Install Dependencies
63
59
run : composer update --ignore-platform-reqs
64
60
65
- - name : Setup PHP 8.2 for PHPStan
66
- uses : shivammathur/setup-php@v2
67
- with :
68
- php-version : 8.2
69
-
70
- - name : Download PHPStan
71
- run : wget https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar
72
-
73
61
- name : Generate new baseline
74
62
id : generate-baseline
75
63
run : |
76
64
cp phpstan-baseline.neon phpstan-baseline.neon.old
77
- php phpstan.phar analyse --configuration phpstan.neon --generate-baseline
65
+ vendor/bin/ phpstan analyse --configuration phpstan.neon --generate-baseline
78
66
if ! diff -q phpstan-baseline.neon phpstan-baseline.neon.old > /dev/null; then
79
67
echo "baseline_changed=true" >> $GITHUB_OUTPUT
80
68
fi
0 commit comments