Commit 01a4a57 1 parent 66dd545 commit 01a4a57 Copy full SHA for 01a4a57
File tree 6 files changed +375
-269
lines changed
6 files changed +375
-269
lines changed Original file line number Diff line number Diff line change 45
45
elif [[ "${{ github.event_name }}" == "push" ]]; then
46
46
npm run lint:js
47
47
fi
48
-
49
- phpcs :
50
- name : phpcs
51
- runs-on : ubuntu-latest
52
-
53
- steps :
54
- - name : Checkout
55
- uses : actions/checkout@v4
56
-
57
- - name : Set standard cache directories
58
- run : |
59
- composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"
60
-
61
- - name : Prepare composer cache
62
- uses : actions/cache@v4
63
- with :
64
- path : ${{ env.COMPOSER_CACHE }}
65
- key : composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
66
- restore-keys : |
67
- composer-${{ env.COMPOSER_VERSION }}-
68
-
69
- - name : Set PHP version
70
- uses : shivammathur/setup-php@v2
71
- with :
72
- php-version : ' 7.4'
73
- coverage : none
74
- tools : composer:v2
75
-
76
- - name : Install dependencies
77
- run : composer install
78
-
79
- - name : Get updated PHP files
80
- id : changed-files
81
- uses : tj-actions/changed-files@v45
82
- with :
83
- files : |
84
- **/*.php
85
-
86
- - name : PHPCS check
87
- run : |
88
- if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then
89
- ./vendor/bin/phpcs ${{ steps.changed-files.outputs.all_changed_files }} -s --runtime-set testVersion 7.4-
90
- elif [[ "${{ github.event_name }}" == "push" ]]; then
91
- ./vendor/bin/phpcs . -s --runtime-set testVersion 7.4-
92
- fi
93
-
94
- vipcs :
95
- name : vipcs
96
- runs-on : ubuntu-latest
97
-
98
- steps :
99
- - name : Checkout
100
- uses : actions/checkout@v4
101
-
102
- - name : VIPCS check
103
- uses : 10up/wpcs-action@stable
104
- with :
105
- enable_warnings : true
106
- standard : ' WordPress-VIP-Go'
107
- excludes : ' tests'
Original file line number Diff line number Diff line change
1
+ name : PHP Linting
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - develop
7
+ - trunk
8
+ paths :
9
+ - " **.php"
10
+ pull_request :
11
+ branches :
12
+ - develop
13
+ paths :
14
+ - " **.php"
15
+
16
+ jobs :
17
+ phpcs :
18
+ runs-on : ubuntu-latest
19
+
20
+ steps :
21
+ - name : Checkout
22
+ uses : actions/checkout@v4
23
+
24
+ - name : Setup proper PHP version
25
+ uses : shivammathur/setup-php@v2
26
+ with :
27
+ php-version : 7.4
28
+
29
+ - name : Get composer cache directory
30
+ id : composer-cache
31
+ run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
32
+
33
+ - name : Cache dependencies
34
+ uses : actions/cache@v4
35
+ with :
36
+ path : ${{ steps.composer-cache.outputs.dir }}
37
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
38
+
39
+ - name : Get changed files
40
+ id : changed-files
41
+ uses : tj-actions/changed-files@v45
42
+ with :
43
+ files : |
44
+ **/*.php
45
+
46
+ - name : Install dependencies
47
+ run : composer install --prefer-dist
48
+
49
+ - name : Run PHP_CodeSniffer
50
+ run : |
51
+ HEAD_REF=$(git rev-parse HEAD)
52
+ git checkout $HEAD_REF
53
+ ./vendor/bin/phpcs-changed -s --git --git-base origin/${{ github.base_ref }} ${{ steps.changed-files.outputs.all_changed_files }}
54
+
55
+ vipcs :
56
+ name : vipcs
57
+ runs-on : ubuntu-latest
58
+
59
+ steps :
60
+ - name : Checkout
61
+ uses : actions/checkout@v4
62
+
63
+ - name : VIPCS check
64
+ uses : 10up/wpcs-action@stable
65
+ with :
66
+ enable_warnings : true
67
+ standard : ' WordPress-VIP-Go'
68
+ excludes : ' tests'
Original file line number Diff line number Diff line change 33
33
"phpstan/extension-installer" : " 1.4.x-dev" ,
34
34
"php-stubs/wp-cli-stubs" : " dev-master" ,
35
35
"johnbillion/wp-compat" : " dev-trunk" ,
36
- "phpstan/phpstan-deprecation-rules" : " 1.2.x-dev"
36
+ "phpstan/phpstan-deprecation-rules" : " 1.2.x-dev" ,
37
+ "sirbrillig/phpcs-changed" : " ^2.11"
37
38
},
38
39
"scripts" : {
39
40
"lint" : " phpcs -s . --runtime-set testVersion 7.4-" ,
You can’t perform that action at this time.
0 commit comments