-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (81 loc) · 2.58 KB
/
_code_style.yml
File metadata and controls
91 lines (81 loc) · 2.58 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Code Style
# TODO: get rid of inputs.style_report
on:
workflow_call:
inputs:
cache_key:
description: "PHP extensions cache key"
required: true
type: string
style_report:
description: "Path to auto-generated style report (todo: delete it later)"
required: true
type: string
php:
description: "PHP version to run on"
required: false
default: "8.1"
type: string
extensions:
description: "PHP extensions"
default: simplexml, mbstring
required: false
type: string
tools:
description: "PHP tools"
required: false
default: composer, cs2pr, squizlabs/php_codesniffer
type: string
ini_values:
description: "PHP ini values"
default: max_execution_time=180, date.timezone=Asia/Tbilisi
required: false
type: string
jobs:
code-style:
timeout-minutes: 15
if: github.event.pull_request.draft == false
name: code-style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php-version: [ 8.1 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup cache environment
id: ext-cache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ inputs.extensions }}
key: ${{ inputs.cache_key }}
- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}
- name: Setup PHP version ${{ matrix.php-version }} on ${{ matrix.os }}
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ inputs.extensions }}
tools: ${{ inputs.tools }}
coverage: none
ini-values: ${{ inputs.ini_values }}
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update: true
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Check PHP code style
continue-on-error: true
run: |
mkdir -p $(dirname "${{ inputs.style_report }}")
phpcs --report-full --report-checkstyle=${{ inputs.style_report }} --standard=PSR12 src/ tests/
- name: Show PHPCS results in PR
run: cs2pr ${{ inputs.style_report }}