-
-
Notifications
You must be signed in to change notification settings - Fork 81
77 lines (64 loc) · 2.01 KB
/
code-quality.yml
File metadata and controls
77 lines (64 loc) · 2.01 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
75
76
77
name: Code Quality
on:
push:
branches: [develop]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyse:
name: PHPStan + phpcs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: >-
phalcon5, mailparse, redis, sqlite3, pcntl,
sockets, curl, zip, simplexml, iconv
tools: cs2pr
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Detect changed PHP files
id: changed
run: |
BASE=${{ github.event.before }}
FILES=$(git diff --name-only --diff-filter=d "$BASE" "${{ github.sha }}" \
-- 'src/**/*.php' | head -500)
if [ -z "$FILES" ]; then
echo "count=0" >> "$GITHUB_OUTPUT"
else
echo "$FILES" > /tmp/changed-php-files.txt
echo "count=$(echo "$FILES" | wc -l | tr -d ' ')" >> "$GITHUB_OUTPUT"
fi
- name: PHPStan
if: steps.changed.outputs.count != '0'
run: |
mkdir -p build/phpstan
cat /tmp/changed-php-files.txt | xargs \
vendor/bin/phpstan analyse \
--configuration=phpstan.neon \
--error-format=github \
--memory-limit=512M \
--no-progress
- name: phpcs
if: steps.changed.outputs.count != '0'
run: >-
vendor/bin/phpcs
--standard=PSR12
--report=checkstyle
--file-list=/tmp/changed-php-files.txt
-q | cs2pr
- name: Composer audit
run: composer audit --format=plain