@@ -88,24 +88,32 @@ jobs:
88
88
# - custom_ini: Whether to run with specific custom ini settings to hit very specific
89
89
# code conditions.
90
90
matrix :
91
+ os : ['ubuntu-latest', 'windows-latest']
91
92
php : ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
92
93
custom_ini : [false]
93
94
94
95
include :
95
96
# Skip test runs on builds which are also run in the coverage job.
96
97
# Note: the tests on PHP 7.2 will still be run as the coverage build uses custom_ini settings for that version.
97
98
- php : ' 5.4'
99
+ os : ' ubuntu-latest'
100
+ skip_tests : true
101
+ - php : ' 5.5'
102
+ os : ' windows-latest'
98
103
skip_tests : true
99
104
- php : ' 8.4'
100
105
skip_tests : true
101
106
102
107
# Extra builds running only the unit tests with different PHP ini settings.
103
108
- php : ' 5.5'
109
+ os : ' ubuntu-latest'
104
110
custom_ini : true
105
111
- php : ' 7.0'
112
+ os : ' ubuntu-latest'
106
113
custom_ini : true
107
114
108
- name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
115
+ # yamllint disable-line rule:line-length
116
+ name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
109
117
110
118
continue-on-error : ${{ matrix.php == '8.5' }}
111
119
@@ -115,6 +123,7 @@ jobs:
115
123
116
124
- name : Setup ini config
117
125
id : set_ini
126
+ shell : bash
118
127
run : |
119
128
# Set the "short_open_tag" ini to make sure specific conditions are tested.
120
129
# Also turn on error_reporting to ensure all notices are shown.
@@ -160,20 +169,20 @@ jobs:
160
169
# Note: The code style check is run multiple times against every PHP version
161
170
# as it also acts as an integration test.
162
171
- name : ' PHPCS: set the path to PHP'
163
- run : php bin/phpcs --config-set php_path php
172
+ run : php " bin/phpcs" --config-set php_path php
164
173
165
- - name : ' PHPUnit: run the tests without code coverage'
174
+ - name : ' PHPUnit: run the full test suite without code coverage'
166
175
if : ${{ matrix.skip_tests != true }}
167
- run : vendor/bin/phpunit tests/AllTests.php --no-coverage
176
+ run : php " vendor/bin/phpunit" tests/AllTests.php --no-coverage
168
177
169
178
- name : ' PHPCS: check code style without cache, no parallel'
170
179
if : ${{ matrix.custom_ini == false && matrix.php != '7.4' }}
171
- run : php bin/phpcs --no-cache --parallel=1
180
+ run : php " bin/phpcs" --no-cache --parallel=1
172
181
173
182
- name : ' PHPCS: check code style to show results in PR'
174
183
if : ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
175
184
id : phpcs
176
- run : php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml
185
+ run : php " bin/phpcs" --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml
177
186
178
187
- name : Show PHPCS results in PR
179
188
if : ${{ always() && steps.phpcs.outcome == 'failure' && matrix.php == '7.4' }}
@@ -191,42 +200,53 @@ jobs:
191
200
run : php phpcs.phar
192
201
193
202
coverage :
194
- runs-on : ubuntu-latest
203
+ runs-on : ${{ matrix.os }}
195
204
196
205
strategy :
197
206
matrix :
207
+ os : ['ubuntu-latest', 'windows-latest']
208
+ php : ['8.4']
209
+ custom_ini : [false]
210
+
198
211
include :
199
212
- php : ' 5.4'
213
+ os : ' ubuntu-latest'
200
214
custom_ini : false
215
+ # Installing on Windows with PHP 5.4 runs into all sorts of problems with Composer.
216
+ # Considering PHP 5.4 is ancient, I deem it acceptable to run coverage on Windows on PHP 5.5.
217
+ # See this issue for more context (yes, I've seen this problem before):
218
+ # @link https://github.com/PHPCSStandards/composer-installer/pull/213
219
+ - php : ' 5.5'
220
+ os : ' windows-latest'
221
+ custom_ini : false
222
+
223
+ # Also run one coverage build with custom ini settings.
201
224
- php : ' 7.2'
225
+ os : ' ubuntu-latest'
202
226
custom_ini : true
203
- - php : ' 8.4'
204
- custom_ini : false
205
227
206
- name : " Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
228
+ # yamllint disable-line rule:line-length
229
+ name : " Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
207
230
208
231
steps :
209
232
- name : Checkout code
210
233
uses : actions/checkout@v4
211
234
212
235
- name : Setup ini config
236
+ if : ${{ matrix.os != 'windows-latest' }}
213
237
id : set_ini
238
+ shell : bash
214
239
run : |
215
240
# Set the "short_open_tag" ini to make sure specific conditions are tested.
216
- # Also turn on error_reporting to ensure all notices are shown.
217
- if [[ ${{ matrix.custom_ini }} == true && "${{ startsWith( matrix.php, '5.' ) }}" == true ]]; then
218
- echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On' >> "$GITHUB_OUTPUT"
219
- elif [[ ${{ matrix.custom_ini }} == true && "${{ startsWith( matrix.php, '7.' ) }}" == true ]]; then
220
- echo 'PHP_INI=error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On' >> "$GITHUB_OUTPUT"
221
- else
222
- echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
241
+ if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '5.4' ]]; then
242
+ echo 'PHP_INI=, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On' >> "$GITHUB_OUTPUT"
223
243
fi
224
244
225
245
- name : Install PHP
226
246
uses : shivammathur/setup-php@v2
227
247
with :
228
248
php-version : ${{ matrix.php }}
229
- ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
249
+ ini-values : error_reporting=-1, display_errors=On ${{ steps.set_ini.outputs.PHP_INI }}
230
250
coverage : xdebug
231
251
232
252
# This action also handles the caching of the dependencies.
@@ -254,38 +274,47 @@ jobs:
254
274
255
275
- name : Grab PHPUnit version
256
276
id : phpunit_version
277
+ shell : bash
257
278
# yamllint disable-line rule:line-length
258
- run : echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
279
+ run : echo "VERSION=$(php " vendor/bin/phpunit" --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
259
280
260
281
- name : " DEBUG: Show grabbed version"
261
282
run : echo ${{ steps.phpunit_version.outputs.VERSION }}
262
283
263
284
- name : ' PHPCS: set the path to PHP'
264
- run : php bin/phpcs --config-set php_path php
285
+ run : php " bin/phpcs" --config-set php_path php
265
286
266
287
# PHPUnit 9.3 started using PHP-Parser for code coverage, which can cause issues due to Parser
267
288
# also polyfilling PHP tokens.
268
289
# As of PHPUnit 9.3.4, a cache warming option is available.
269
290
# Using that option prevents issues with PHP-Parser backfilling PHP tokens during our test runs.
270
291
- name : " Warm the PHPUnit cache (PHPUnit 9.3+)"
271
292
if : ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
272
- run : vendor/bin/phpunit --coverage-cache ./build/phpunit-cache --warm-coverage-cache
293
+ run : php " vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache --warm-coverage-cache
273
294
274
295
- name : " Run the unit tests with code coverage (PHPUnit < 9.3)"
275
- if : ${{ steps.phpunit_version.outputs.VERSION < '9.3' }}
276
- run : vendor/bin/phpunit tests/AllTests.php
296
+ if : ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
297
+ run : php " vendor/bin/phpunit" tests/AllTests.php
277
298
278
299
- name : " Run the unit tests with code coverage (PHPUnit 9.3+)"
279
- if : ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
280
- run : vendor/bin/phpunit tests/AllTests.php --coverage-cache ./build/phpunit-cache
300
+ if : ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
301
+ run : php "vendor/bin/phpunit" tests/AllTests.php --coverage-cache ./build/phpunit-cache
302
+
303
+ - name : " Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit < 9.3)"
304
+ if : ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
305
+ run : php "vendor/bin/phpunit" tests/AllTests.php --group Windows
306
+
307
+ - name : " Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit 9.3+)"
308
+ if : ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
309
+ run : php "vendor/bin/phpunit" tests/AllTests.php --group Windows --coverage-cache ./build/phpunit-cache
281
310
282
311
- name : Upload coverage results to Coveralls
283
312
if : ${{ success() }}
284
313
uses : coverallsapp/github-action@v2
285
314
with :
286
315
format : clover
287
316
file : build/logs/clover.xml
288
- flag-name : php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
317
+ flag-name : os-${{ matrix.os }}- php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
289
318
parallel : true
290
319
291
320
coveralls-finish :
0 commit comments