-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (46 loc) · 1.55 KB
/
php-cs.yml
File metadata and controls
55 lines (46 loc) · 1.55 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
name: 'php-cs'
on:
workflow_call:
inputs:
php_versions:
description: PHP versions to use, string formatted as JSON array
required: true
type: string
jobs:
cs:
name: 'Check coding style'
if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')"
runs-on: 'ubuntu-latest'
strategy:
matrix:
php-version: ${{ fromJSON(inputs.php_versions) }}
steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v6'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
tools: 'composer:v2'
extensions: 'mbstring, intl'
coverage: 'none'
- name: 'Discover Composer cache directory'
id: 'cachedir'
run: echo "path=$(composer global config cache-dir)" >> $GITHUB_OUTPUT
- name: 'Share Composer cache across runs'
uses: 'actions/cache@v5'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}"
restore-keys: |
composer-${{ github.job }}-
composer-
- name: 'Install dependencies with Composer'
run: 'composer install --prefer-dist --no-interaction'
- name: 'Run PHP CodeSniffer'
run: |
if composer run --list | grep -q "cs-check"; then
composer run cs-check
else
vendor/bin/phpcs -n
fi