1616 level : [ 0, 1, 2 ]
1717 include :
1818 - current-level : 0
19+ - max-level : 2
1920 steps :
2021 - uses : actions/checkout@v4
2122
@@ -27,16 +28,39 @@ jobs:
2728 - name : Install PHPStan
2829 run : composer require --dev phpstan/phpstan
2930
31+ - name : Restore cached baseline for PHPStan
32+ id : cache-baseline-restore
33+ uses : actions/cache/restore@v4
34+ with :
35+ path : |
36+ test/phpstan-baseline.neon
37+ key : phpstan-baseline-${{ hashFiles('test/phpstan-baseline.neon') }}
38+ restore-keys : |
39+ phpstan-baseline-
40+
3041 - name : Run PHPStan
31- if : matrix.level == matrix.current-level
42+ if : matrix.level == matrix.current-level
3243 continue-on-error : true
3344 run : |
34- ./vendor/bin/phpstan analyse -l "${{ matrix.level }}" --memory-limit 128M src test
45+ ./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test - l "${{ matrix.level }}"
3546 exit 0
3647
3748 - name : Run PHPStan
38- if : matrix.level > matrix.current-level
49+ if : matrix.level > matrix.current-level
3950 continue-on-error : true
4051 run : |
41- ./vendor/bin/phpstan analyse -l "${{ matrix.level }}" --memory-limit 128M src test
52+ ./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test - l "${{ matrix.level }}"
4253 exit 0
54+
55+ - name : Generate the baseline for PHPStan
56+ if : matrix.level == matrix.max-level && github.event.pull_request.merged == true
57+ run : |
58+ ./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon --generate-baseline test/phpstan-baseline.neon src test -l "${{ matrix.level }}"
59+
60+ - name : Save the baseline for PHPStan
61+ id : cache-baseline-save
62+ uses : actions/cache/save@v4
63+ with :
64+ path : |
65+ test/phpstan-baseline.neon
66+ key : phpstan-baseline-${{ hashFiles('test/phpstan-baseline.neon') }}
0 commit comments