12
12
# Allow manually triggering the workflow.
13
13
workflow_dispatch :
14
14
15
+ # Cancels all previous workflow runs for the same branch that have not yet completed.
16
+ concurrency :
17
+ # The concurrency group contains the workflow name and the branch name.
18
+ group : ${{ github.workflow }}-${{ github.ref }}
19
+ cancel-in-progress : true
20
+
15
21
jobs :
16
22
# ### PHP LINT STAGE ####
17
23
# Linting against high/low PHP versions should catch everything.
@@ -21,15 +27,10 @@ jobs:
21
27
22
28
strategy :
23
29
matrix :
24
- php : ['5.4', 'latest']
25
- experimental : [false]
26
-
27
- include :
28
- - php : ' 8.1'
29
- experimental : true
30
+ php : ['5.4', 'latest', '8.2']
30
31
31
32
name : " Lint: PHP ${{ matrix.php }}"
32
- continue-on-error : ${{ matrix.experimental }}
33
+ continue-on-error : ${{ matrix.php == '8.2' }}
33
34
34
35
steps :
35
36
- name : Checkout code
43
44
tools : cs2pr
44
45
45
46
- name : Install Composer dependencies
46
- uses : " ramsey/composer-install@v1 "
47
+ uses : " ramsey/composer-install@v2 "
47
48
48
49
- name : Lint against parse errors
49
50
run : ./bin/php-lint --checkstyle | cs2pr
83
84
wpcs_version : ' 2.3.*'
84
85
experimental : false
85
86
87
+ # Complete the matrix by adding PHP 8.1, but only test against compatible PHPCS versions.
88
+ - php : ' 8.1'
89
+ phpcs_version : ' dev-master'
90
+ wpcs_version : ' 2.3.*'
91
+ experimental : false
92
+ - php : ' 8.1'
93
+ # PHPCS 3.6.1 is the lowest version of PHPCS which supports PHP 8.1.
94
+ phpcs_version : ' 3.6.1'
95
+ wpcs_version : ' 2.3.*'
96
+ experimental : false
97
+
86
98
# Experimental builds. These are allowed to fail.
87
- # - php: '8.1 '
99
+ # - php: '8.2 '
88
100
# phpcs_version: 'dev-master'
89
101
# wpcs_version: '2.3.*'
90
102
# experimental: true
@@ -99,13 +111,16 @@ jobs:
99
111
100
112
# On stable PHPCS versions, allow for PHP deprecation notices.
101
113
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
114
+ # Note: the "elif" condition is temporary and should be removed once VIPCS updates to WPCS 3.0+.
102
115
- name : Setup ini config
103
116
id : set_ini
104
117
run : |
105
118
if [[ "${{ matrix.phpcs_version }}" != "dev-master" ]]; then
106
119
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
120
+ elif [[ "${{ matrix.php }}" == "8.1" ]]; then
121
+ echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
107
122
else
108
- echo '::set-output name=PHP_INI::error_reporting=E_ALL '
123
+ echo '::set-output name=PHP_INI::error_reporting=-1 '
109
124
fi
110
125
111
126
- name : Install PHP
@@ -117,25 +132,30 @@ jobs:
117
132
118
133
- name : ' Composer: set PHPCS and WPCS versions for tests'
119
134
run : |
120
- composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"
121
- composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}"
135
+ composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-interaction
136
+ composer require --no-update --no-scripts wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}" --no-interaction
122
137
123
138
# Install dependencies and handle caching in one go.
124
139
# @link https://github.com/marketplace/actions/install-composer-dependencies
125
140
- name : Install Composer dependencies - normal
126
141
if : ${{ startsWith( matrix.php, '8' ) == false }}
127
- uses : " ramsey/composer-install@v1 "
142
+ uses : " ramsey/composer-install@v2 "
128
143
129
144
# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform
130
145
# requirements to get PHPUnit 7.x to install on nightly.
131
146
- name : Install Composer dependencies - with ignore platform
132
147
if : ${{ startsWith( matrix.php, '8' ) }}
133
- uses : " ramsey/composer-install@v1 "
148
+ uses : " ramsey/composer-install@v2 "
134
149
with :
135
150
composer-options : --ignore-platform-reqs
136
151
137
- - name : Run the unit tests
152
+ - name : Run the unit tests - PHP 5.4 - 8.0
153
+ if : matrix.php < '8.1'
138
154
run : ./bin/unit-tests
139
155
156
+ - name : Run the unit tests - PHP > 8.1
157
+ if : matrix.php >= '8.1'
158
+ run : vendor/bin/phpunit --filter WordPressVIPMinimum ./vendor/squizlabs/php_codesniffer/tests/AllTests.php --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests
159
+
140
160
- name : Run the ruleset tests
141
161
run : ./bin/ruleset-tests
0 commit comments