Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
level: [ 0, 1, 2 ]
include:
- current-level: 0
- max-level: 2
steps:
- uses: actions/checkout@v4

Expand All @@ -27,16 +28,39 @@ jobs:
- name: Install PHPStan
run: composer require --dev phpstan/phpstan

- name: Restore cached baseline for PHPStan
id: cache-baseline-restore
uses: actions/cache/restore@v4
with:
path: |
test/phpstan-baseline.neon
key: phpstan-baseline-${{ hashFiles('test/phpstan-baseline.neon') }}
restore-keys: |
phpstan-baseline-

- name: Run PHPStan
if: matrix.level == matrix.current-level
if: matrix.level == matrix.current-level
continue-on-error: true
run: |
./vendor/bin/phpstan analyse -l "${{ matrix.level }}" --memory-limit 128M src test
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test -l "${{ matrix.level }}"
exit 0

- name: Run PHPStan
if: matrix.level > matrix.current-level
if: matrix.level > matrix.current-level
continue-on-error: true
run: |
./vendor/bin/phpstan analyse -l "${{ matrix.level }}" --memory-limit 128M src test
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon src test -l "${{ matrix.level }}"
exit 0

- name: Generate the baseline for PHPStan
if: matrix.level == matrix.max-level && github.event.pull_request.merged == true
run: |
./vendor/bin/phpstan analyse --memory-limit 1G -c test/phpstan.neon --generate-baseline test/phpstan-baseline.neon src test -l "${{ matrix.level }}"

- name: Save the baseline for PHPStan
id: cache-baseline-save
uses: actions/cache/save@v4
with:
path: |
test/phpstan-baseline.neon
key: phpstan-baseline-${{ hashFiles('test/phpstan-baseline.neon') }}
5 changes: 5 additions & 0 deletions test/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
includes:
- phpstan-baseline.neon

parameters:
reportUnmatchedIgnoredErrors: false