-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
74 lines (66 loc) · 1.94 KB
/
Copy pathaction.yml
File metadata and controls
74 lines (66 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: 'PHPStan Analysis'
description: 'Run PHPStan static analysis'
author: 'Zeroseven'
branding:
icon: 'check-circle'
color: 'green'
inputs:
php-version:
description: 'PHP version to use'
required: false
default: '8.3'
config:
description: 'Path to phpstan.neon configuration file'
required: true
paths:
description: 'Paths to analyze (space-separated)'
required: false
default: '.'
level:
description: 'Analysis level (0-9, or max)'
required: false
default: ''
memory-limit:
description: 'Memory limit for PHPStan'
required: false
default: '1G'
error-format:
description: 'Error output format'
required: false
default: 'github'
runs:
using: 'composite'
steps:
- name: Check config file exists
shell: bash
run: |
if [ ! -f "${{ inputs.config }}" ]; then
echo "::error::PHPStan config file not found: ${{ inputs.config }}"
echo "::error::Please create a phpstan.neon file in your project root"
exit 1
fi
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
coverage: none
- name: Cache PHPStan results
uses: actions/cache@v4
with:
path: .phpstan/
key: phpstan-${{ runner.os }}-${{ inputs.php-version }}-${{ hashFiles('**/composer.lock', inputs.config) }}
restore-keys: |
phpstan-${{ runner.os }}-${{ inputs.php-version }}-
phpstan-${{ runner.os }}-
- name: Run PHPStan
shell: bash
run: |
PHPSTAN_CMD="vendor/bin/phpstan analyze \
--no-progress \
--memory-limit=${{ inputs.memory-limit }} \
--configuration=${{ inputs.config }} \
--error-format=${{ inputs.error-format }}"
if [ -n "${{ inputs.level }}" ]; then
PHPSTAN_CMD="$PHPSTAN_CMD --level=${{ inputs.level }}"
fi
$PHPSTAN_CMD ${{ inputs.paths }}