-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.73 KB
/
static-analysis.yml
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
name: Static Analysis
on:
workflow_call:
secrets:
COMPOSER_ENV:
required: true
description: COMPOSER_ENV Secret
jobs:
phpstsan:
name: phpstan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Detect File Changes
uses: dorny/paths-filter@v2
id: changed-files
with:
list-files: shell
filters: |
phpstan:
- added|modified: '*.php'
- added|modified: 'phpstan.neon.dist'
- name: Configure PHP environment
if: steps.changed-files.outputs.phpstan == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: mbstring, intl
coverage: none
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
if: steps.changed-files.outputs.phpstan == 'true'
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: steps.changed-files.outputs.phpstan == 'true'
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer
if: steps.changed-files.outputs.phpstan == 'true'
run: |
echo "${{ secrets.COMPOSER_ENV }}" >> .env
composer install --ignore-platform-reqs --optimize-autoloader --no-progress
rm .env
- name: Run PHPStan static analysis
if: steps.changed-files.outputs.phpstan == 'true'
run: composer phpstan