Repository navigation
63 lines (54 loc) · 2.23 KB
/
Copy pathreusable-phpstan.yml
File metadata and controls
63 lines (54 loc) · 2.23 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
name: Run PHPStan
on:
workflow_call:
inputs:
php-version:
description: 'PHP version to use'
required: true
type: string
working-directory:
description: 'Plugin directory, relative to the repository root.'
required: false
type: string
default: '.'
permissions: {}
jobs:
phpstan:
name: PHPStan Static Analysis
runs-on: ubuntu-24.04
timeout-minutes: 20
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Set up PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2.40.0
with:
php-version: ${{ inputs.php-version }}
coverage: none
tools: cs2pr
- name: Restore PHPStan result cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ inputs.working-directory }}/tests/_output
key: phpstan-result-cache-${{ runner.os }}-${{ inputs.working-directory }}-php${{ inputs.php-version }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
phpstan-result-cache-${{ runner.os }}-${{ inputs.working-directory }}-php${{ inputs.php-version }}-
- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
with:
working-directory: ${{ inputs.working-directory }}
- name: Run PHPStan
id: phpstan
run: composer run-script phpstan -- --memory-limit=1G --error-format=checkstyle | cs2pr
- name: Save PHPStan result cache
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: ${{ !cancelled() && steps.phpstan.outcome != 'skipped' }}
with:
path: ${{ inputs.working-directory }}/tests/_output
key: phpstan-result-cache-${{ runner.os }}-${{ inputs.working-directory }}-php${{ inputs.php-version }}-${{ github.run_id }}-${{ github.run_attempt }}