Skip to content

Commit f30557f

Browse files
committed
Try to generate the baseline for PHPStan
1 parent 645cf07 commit f30557f

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/phpstan.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
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') }}

test/phpstan.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
reportUnmatchedIgnoredErrors: false

0 commit comments

Comments
 (0)