-
Notifications
You must be signed in to change notification settings - Fork 20
50 lines (39 loc) · 1.23 KB
/
reusable-coding-standards-php.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
##
# A reusable workflow that checks the PHP coding standards.
##
name: PHP coding standards
on:
workflow_call:
jobs:
phpcs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.0', '7.4', '8.0', '8.1', '8.2', '8.3']
permissions:
contents: read
name: Run coding standards checks on ${{ matrix.php-versions }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: cs2pr
env:
runner: self-hosted
- name: Install Composer dependencies
run: composer install
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Run PHPCS on all files
id: phpcs
run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./.cache/phpcs-report.xml
- name: Ensure version-controlled files are not modified or deleted
run: git diff --exit-code