Skip to content

Commit

Permalink
Merge pull request #14 from matsuo/phpstan
Browse files Browse the repository at this point in the history
Run PHPStan on GitHub Actions
  • Loading branch information
kznakata committed Aug 15, 2023
2 parents 2341f1f + 432e7d8 commit 2c503d8
Show file tree
Hide file tree
Showing 4 changed files with 592 additions and 378 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: run-phpstan

on:
push:
branches:
- "*"
pull_request:
branches: [ 'master', 'main' ]

jobs:
run:
name: Run PHPStan
runs-on: 'ubuntu-latest'
strategy:
matrix:
level: [ 0, 1, 2 ]
include:
- current-level: 0
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Setup PHP
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
with:
php-version: '8.1'

- name: Install PHPStan
run: |
composer require --dev phpstan/phpstan
composer require --dev szepeviktor/phpstan-wordpress
composer update --classmap-authoritative
- name: Run PHPStan
if: matrix.level == matrix.current-level
continue-on-error: true
run: |
./vendor/bin/phpstan analyse -c tests/phpstan.neon -l "${{ matrix.level }}" --memory-limit 1024M
exit 0
- name: Run PHPStan
if: matrix.level > matrix.current-level
continue-on-error: true
run: |
./vendor/bin/phpstan analyse -c tests/phpstan.neon -l "${{ matrix.level }}" --memory-limit 1024M
exit 0
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"wp-coding-standards/wpcs": "^2.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^8",
"yoast/phpunit-polyfills": "^1.0.3"
},
"require": {
"yoast/phpunit-polyfills": "^1.0.3",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.3"
}
}
Loading

0 comments on commit 2c503d8

Please sign in to comment.