-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphpcbf.yml
77 lines (62 loc) · 1.85 KB
/
phpcbf.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Run PHP CodeSniffer
on:
workflow_dispatch: # Manual trigger
push:
branches:
- main
paths:
- '**/*.php'
- '**/*.yml'
- 'composer.json'
- 'composer.lock'
jobs:
php-codesniffer:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1' ] # Updated PHP version to 8.1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer, cs2pr
- name: Install Composer Dependencies
run: composer install --prefer-dist --no-progress
- name: Get Changed PHP Files
id: changed-files
run: |
echo "::set-output name=files::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.php$' || true)"
- name: Run PHPCBF on Changed Files
if: steps.changed-files.outputs.files != ''
continue-on-error: true
run: |
echo "${{ steps.changed-files.outputs.files }}" | xargs vendor/bin/phpcbf
- name: Commit PHPCBF Changes
if: steps.changed-files.outputs.files != '' && success()
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖 PHPCBF fixes"
file_pattern: |
**/*.php
composer.lock
phpunit:
runs-on: ubuntu-latest
needs: php-codesniffer
strategy:
matrix:
php: [ '8.1' ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
- name: Install Composer Dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHPUnit Tests
run: vendor/bin/phpunit