-
-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github: Run PHPStan as action on every push
This should prevent regressions in code flaws detected by PHPStan. Also, PHPStan complains when the baseline is not advanced after fixing a flaw. This should prevent a flaw from reappearing later on.
- Loading branch information
1 parent
ce95b7c
commit 4b5fb72
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: PHPStan Static Analyzer | ||
on: [push] | ||
jobs: | ||
run-phpstan: | ||
name: Run PHPStan | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.3' | ||
extensions: json, xdebug | ||
tools: composer:v2 | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get Composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Connect downloaded dependencies with a cache in GitHub | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
# Note: Normally, we'd use the composer.lock to generate a hash, | ||
# but the lock file is currently not versioned. | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist | ||
|
||
- name: Audit dependencies | ||
run: composer audit | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/phpstan analyse |