Skip to content

Commit 1e6711f

Browse files
authored
[CI] Add reusable SA workflow #2
[CI] Add reusable SA workflow
2 parents 33cc795 + 3277755 commit 1e6711f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

workflows/SA.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: SA (Static Analysis)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
php-version:
7+
type: string
8+
required: false
9+
default: '8.4'
10+
phpstan-args:
11+
type: string
12+
required: false
13+
default: 'analyse --no-progress --memory-limit=-1'
14+
secrets:
15+
GITHUB_TOKEN:
16+
required: false
17+
18+
jobs:
19+
sa:
20+
name: "Static Analysis (PHP ${{ inputs.php-version }})"
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: "Checkout repository"
25+
uses: actions/checkout@v4
26+
27+
- name: "Setup PHP ${{ inputs.php-version }}"
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ inputs.php-version }}
31+
coverage: none
32+
tools: phpstan, composer
33+
34+
- name: "Cache Composer dependencies"
35+
uses: actions/cache@v4
36+
with:
37+
path: ~/.composer/cache
38+
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
39+
restore-keys: composer-${{ runner.os }}-
40+
41+
- name: "Composer install"
42+
run: composer install --no-interaction --prefer-dist --no-progress
43+
44+
- name: "Run PHPStan"
45+
run: |
46+
if [ -x vendor/bin/phpstan ]; then
47+
BIN=vendor/bin/phpstan
48+
else
49+
BIN=phpstan
50+
fi
51+
$BIN --version
52+
$BIN ${{ inputs.phpstan-args }}

0 commit comments

Comments
 (0)