Skip to content

Commit d35349b

Browse files
committed
Extract PHPStan into dedicated workflow
1 parent 7e1c682 commit d35349b

File tree

2 files changed

+80
-3
lines changed

2 files changed

+80
-3
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Static Analysis
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'src/**'
7+
- 'tests/**'
8+
- '.github/workflows/static-analysis.yml'
9+
- 'composer.json'
10+
- 'phpstan.neon.dist'
11+
push:
12+
branches: ['7.x']
13+
paths:
14+
- 'src/**'
15+
- 'tests/**'
16+
- '.github/workflows/static-analysis.yml'
17+
- 'composer.json'
18+
- 'phpstan.neon.dist'
19+
workflow_dispatch:
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
phpstan:
26+
name: "PHPStan (PHP ${{ matrix.php }})"
27+
runs-on: ubuntu-latest
28+
if: github.actor != 'dependabot[bot]'
29+
30+
strategy:
31+
matrix:
32+
php:
33+
- "8.1"
34+
- "8.2"
35+
- "8.3"
36+
- "8.4"
37+
include:
38+
- php: "8.5"
39+
composer-options: "--ignore-platform-reqs"
40+
41+
env:
42+
extensions: ctype, dom, grpc, json, mbstring, openssl, xml, zip, zlib
43+
key: cache-static-analysis-7x-${{ matrix.php }}-v1
44+
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v5
48+
49+
- name: Setup cache environment
50+
id: extcache
51+
uses: shivammathur/cache-extensions@v1
52+
with:
53+
php-version: ${{ matrix.php }}
54+
extensions: ${{ env.extensions }}
55+
key: ${{ env.key }}
56+
57+
- name: Cache extensions
58+
uses: actions/[email protected]
59+
with:
60+
path: ${{ steps.extcache.outputs.dir }}
61+
key: ${{ steps.extcache.outputs.key }}
62+
restore-keys: ${{ steps.extcache.outputs.key }}
63+
64+
- name: Setup PHP
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: ${{ matrix.php }}
68+
extensions: ${{ env.extensions }}
69+
tools: composer, pecl
70+
coverage: none
71+
72+
- uses: "ramsey/composer-install@v3"
73+
with:
74+
composer-options: "${{ matrix.composer-options }}"
75+
76+
- name: Setup problem matchers for PHP
77+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
78+
79+
- name: Run PHPStan
80+
run: XDEBUG_MODE=off vendor/bin/phpstan analyse --no-progress --error-format=github

.github/workflows/tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ jobs:
8181
- name: Setup problem matchers for PHP
8282
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
8383

84-
- name: Run PHPStan
85-
run: XDEBUG_MODE=off vendor/bin/phpstan analyse --no-progress
86-
8784
- name: Setup Problem Matchers for PHPUnit
8885
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8986

0 commit comments

Comments
 (0)