-
Notifications
You must be signed in to change notification settings - Fork 6
73 lines (67 loc) · 2.43 KB
/
Copy pathstatic-analysis-php.yml
File metadata and controls
73 lines (67 loc) · 2.43 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
name: Static code analysis PHP
on:
workflow_call:
inputs:
PHP_VERSION:
description: PHP version with which the scripts are executed.
default: '8.2'
required: false
type: string
PHP_EXTENSIONS:
description: PHP extensions supported by shivammathur/setup-php to be installed or disabled.
default: ''
required: false
type: string
COMPOSER_ARGS:
description: Set of arguments passed to Composer.
default: '--prefer-dist'
required: false
type: string
PSALM_ARGS:
description: Set of arguments passed to Psalm.
default: '--output-format=github --no-cache'
required: false
type: string
PHPSTAN_ARGS:
description: Set of arguments passed to PHPStan.
default: '--no-progress --memory-limit=1G'
required: false
type: string
secrets:
COMPOSER_AUTH_JSON:
description: Authentication for privately hosted packages and repositories as a JSON formatted object.
required: false
ENV_VARS:
description: Additional environment variables as a JSON formatted object.
required: false
jobs:
static-analysis-php:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up custom environment variables
env:
ENV_VARS: ${{ secrets.ENV_VARS }}
if: ${{ env.ENV_VARS }}
uses: actions/github-script@v7
with:
script: |
JSON
.parse(process.env.ENV_VARS)
.forEach(envVar => core.exportVariable(envVar.name, envVar.value));
- name: Set up PHP
uses: inpsyde/reusable-workflows/.github/actions/setup-php@main
with:
php-version: ${{ inputs.PHP_VERSION }}
php-extensions: ${{ inputs.PHP_EXTENSIONS }}
php-tools: 'composer, cs2pr'
composer-options: ${{ inputs.COMPOSER_ARGS }}
composer-auth-json: ${{ secrets.COMPOSER_AUTH_JSON }}
- name: Run Psalm
if: ${{ hashFiles('psalm.xml', 'psalm.xml.dist') != '' }}
run: ./$(composer config bin-dir)/psalm --php-version="${{ inputs.PHP_VERSION }}" ${{ inputs.PSALM_ARGS }}
- name: Run PHPStan
if: ${{ hashFiles('phpstan.dist.neon', 'phpstan.neon', 'phpstan.neon.dist') != '' }}
run: ./$(composer config bin-dir)/phpstan ${{ inputs.PHPSTAN_ARGS }}