Skip to content

Commit edfed67

Browse files
committed
Run PHPStan on GitHub Actions
1 parent af5ad21 commit edfed67

3 files changed

Lines changed: 107 additions & 2 deletions

File tree

.github/workflows/phpstan.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: run-phpstan
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
pull_request:
8+
branches: [ 'master', 'main' ]
9+
10+
jobs:
11+
run:
12+
name: Run PHPStan
13+
runs-on: 'ubuntu-latest'
14+
strategy:
15+
matrix:
16+
level: [ 0, 1, 2 ]
17+
include:
18+
- current-level: 0
19+
steps:
20+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@72ae4ccbe57f82bbe08411e84e2130bd4ba1c10f # v2.25.5
24+
with:
25+
php-version: '8.1'
26+
27+
- name: Install PHPStan
28+
run: composer require --dev phpstan/phpstan
29+
30+
- name: Run PHPStan
31+
if: matrix.level == matrix.current-level
32+
continue-on-error: true
33+
run: |
34+
./vendor/bin/phpstan analyse -l "${{ matrix.level }}" --memory-limit 128M src test
35+
exit 0
36+
37+
- name: Run PHPStan
38+
if: matrix.level > matrix.current-level
39+
continue-on-error: true
40+
run: |
41+
./vendor/bin/phpstan analyse -l "${{ matrix.level }}" --memory-limit 128M src test
42+
exit 0

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "*",
19-
"phpdocumentor/phpdocumentor": ">=3"
19+
"phpdocumentor/phpdocumentor": ">=3",
20+
"phpstan/phpstan": "^1.10"
2021
},
2122
"autoload": {
2223
"psr-4": {

composer.lock

Lines changed: 63 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)