68
68
#
69
69
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
70
70
php : ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.5']
71
- phpcs_version : ['lowest', 'stable']
71
+ phpcs_version : ['lowest', 'stable', '4.x-dev' ]
72
72
phpcsutils_version : ['stable']
73
73
74
+ exclude :
75
+ - php : ' 5.5'
76
+ phpcs_version : ' 4.x-dev'
77
+ - php : ' 5.6'
78
+ phpcs_version : ' 4.x-dev'
79
+ - php : ' 7.0'
80
+ phpcs_version : ' 4.x-dev'
81
+ - php : ' 7.1'
82
+ phpcs_version : ' 4.x-dev'
83
+
74
84
include :
75
85
# Add some builds with variations of the dependency versions.
76
86
# Note: the PHPCS low/stable + Utils stable combi is already run via the above matrix.
@@ -87,14 +97,14 @@ jobs:
87
97
- php : ' 5.4'
88
98
phpcs_version : ' dev-master'
89
99
phpcsutils_version : ' dev-develop'
90
- - php : ' 7.0 '
100
+ - php : ' 7.2 '
91
101
phpcs_version : ' dev-master'
92
102
phpcsutils_version : ' dev-develop'
93
103
- php : ' 7.4'
94
- phpcs_version : ' dev-master '
104
+ phpcs_version : ' 4.x-dev '
95
105
phpcsutils_version : ' dev-develop'
96
- - php : ' 8.4 '
97
- phpcs_version : ' dev-master '
106
+ - php : ' 8.2 '
107
+ phpcs_version : ' 4.x-dev '
98
108
phpcsutils_version : ' dev-develop'
99
109
100
110
name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - Utils ${{ matrix.phpcsutils_version }}"
@@ -125,6 +135,10 @@ jobs:
125
135
ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
126
136
coverage : none
127
137
138
+ # Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
139
+ - name : ' Composer: remove PHPCSDevCS'
140
+ run : composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
141
+
128
142
- name : " Composer: set PHPCS version for tests (dev/specific version)"
129
143
if : ${{ matrix.phpcs_version != 'lowest' && matrix.phpcs_version != 'stable' }}
130
144
run : composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
@@ -157,8 +171,19 @@ jobs:
157
171
- name : Composer info
158
172
run : composer info
159
173
160
- - name : Run the unit tests
161
- run : composer test
174
+ - name : Grab PHPCS version
175
+ id : phpcs_version
176
+ # yamllint disable-line rule:line-length
177
+ run : echo "VERSION=$(vendor/bin/phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
178
+
179
+ - name : Run the unit tests (PHPCS 3.x)
180
+ if : ${{ startsWith( steps.phpcs_version.outputs.VERSION, '3.' ) }}
181
+ run : composer test-phpcs3
182
+
183
+ - name : Run the unit tests (PHPCS 4.x)
184
+ if : ${{ startsWith( steps.phpcs_version.outputs.VERSION, '4.' ) }}
185
+ run : composer test-phpcs4
186
+
162
187
163
188
# ### CODE COVERAGE STAGE ####
164
189
# N.B.: Coverage is only checked on the lowest and highest stable PHP versions
@@ -175,23 +200,54 @@ jobs:
175
200
strategy :
176
201
matrix :
177
202
php : ['5.4', '8.4']
178
- dependencies : ['lowest', 'stable']
203
+ dependencies : ['lowest', 'stable', 'dev']
204
+
205
+ exclude :
206
+ - php : ' 5.4'
207
+ dependencies : ' dev'
208
+
209
+ include :
210
+ # Replace the "low PHP" dev build for PHPCS 4.x.
211
+ - php : ' 7.2'
212
+ dependencies : ' dev'
179
213
180
214
name : " Coverage: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}"
181
215
182
216
steps :
183
217
- name : Checkout code
184
218
uses : actions/checkout@v4
185
219
220
+ # On stable PHPCS versions, allow for PHP deprecation notices.
221
+ # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
222
+ - name : Setup ini config
223
+ id : set_ini
224
+ # yamllint disable rule:line-length
225
+ run : |
226
+ if [ "${{ matrix.dependencies == 'dev' }}" == "false" ]; then
227
+ echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
228
+ else
229
+ echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
230
+ fi
231
+ # yamllint enable rule:line-length
232
+
186
233
- name : Install PHP
187
234
uses : shivammathur/setup-php@v2
188
235
with :
189
236
php-version : ${{ matrix.php }}
190
- # On stable PHPCS versions, allow for PHP deprecation notices.
191
- # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
192
- ini-values : PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On
237
+ ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
193
238
coverage : xdebug
194
239
240
+ # Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
241
+ - name : ' Composer: remove PHPCSDevCS'
242
+ run : composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
243
+
244
+ - name : " Composer: set PHPCS version for tests (dev)"
245
+ if : ${{ matrix.dependencies == 'dev' }}
246
+ run : >
247
+ composer require --no-scripts --no-interaction
248
+ squizlabs/php_codesniffer:"4.x-dev"
249
+ phpcsstandards/phpcsutils:"dev-develop"
250
+
195
251
- name : " Composer: use lock file when necessary"
196
252
if : ${{ matrix.dependencies == 'lowest' }}
197
253
run : composer config --unset lock
@@ -211,8 +267,18 @@ jobs:
211
267
squizlabs/php_codesniffer
212
268
phpcsstandards/phpcsutils
213
269
214
- - name : Run the unit tests with code coverage
215
- run : composer coverage
270
+ - name : Grab PHPCS version
271
+ id : phpcs_version
272
+ # yamllint disable-line rule:line-length
273
+ run : echo "VERSION=$(vendor/bin/phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
274
+
275
+ - name : Run the unit tests with code coverage (PHPCS 3.x)
276
+ if : ${{ startsWith( steps.phpcs_version.outputs.VERSION, '3.' ) }}
277
+ run : composer coverage-phpcs3
278
+
279
+ - name : Run the unit tests with code coverage (PHPCS 4.x)
280
+ if : ${{ startsWith( steps.phpcs_version.outputs.VERSION, '4.' ) }}
281
+ run : composer coverage-phpcs4
216
282
217
283
- name : Upload coverage results to Coveralls
218
284
if : ${{ success() }}
0 commit comments