@@ -88,24 +88,32 @@ jobs:
8888 # - custom_ini: Whether to run with specific custom ini settings to hit very specific
8989 # code conditions.
9090 matrix :
91+ os : ['ubuntu-latest', 'windows-latest']
9192 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']
9293 custom_ini : [false]
9394
9495 include :
9596 # Skip test runs on builds which are also run in the coverage job.
9697 # Note: the tests on PHP 7.2 will still be run as the coverage build uses custom_ini settings for that version.
9798 - php : ' 5.4'
99+ os : ' ubuntu-latest'
100+ skip_tests : true
101+ - php : ' 5.5'
102+ os : ' windows-latest'
98103 skip_tests : true
99104 - php : ' 8.4'
100105 skip_tests : true
101106
102107 # Extra builds running only the unit tests with different PHP ini settings.
103108 - php : ' 5.5'
109+ os : ' ubuntu-latest'
104110 custom_ini : true
105111 - php : ' 7.0'
112+ os : ' ubuntu-latest'
106113 custom_ini : true
107114
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' }})"
109117
110118 continue-on-error : ${{ matrix.php == '8.5' }}
111119
@@ -115,6 +123,7 @@ jobs:
115123
116124 - name : Setup ini config
117125 id : set_ini
126+ shell : bash
118127 run : |
119128 # Set the "short_open_tag" ini to make sure specific conditions are tested.
120129 # Also turn on error_reporting to ensure all notices are shown.
@@ -160,20 +169,20 @@ jobs:
160169 # Note: The code style check is run multiple times against every PHP version
161170 # as it also acts as an integration test.
162171 - 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
164173
165- - name : ' PHPUnit: run the tests without code coverage'
174+ - name : ' PHPUnit: run the full test suite without code coverage'
166175 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
168177
169178 - name : ' PHPCS: check code style without cache, no parallel'
170179 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
172181
173182 - name : ' PHPCS: check code style to show results in PR'
174183 if : ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
175184 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
177186
178187 - name : Show PHPCS results in PR
179188 if : ${{ always() && steps.phpcs.outcome == 'failure' && matrix.php == '7.4' }}
@@ -191,42 +200,53 @@ jobs:
191200 run : php phpcs.phar
192201
193202 coverage :
194- runs-on : ubuntu-latest
203+ runs-on : ${{ matrix.os }}
195204
196205 strategy :
197206 matrix :
207+ os : ['ubuntu-latest', 'windows-latest']
208+ php : ['8.4']
209+ custom_ini : [false]
210+
198211 include :
199212 - php : ' 5.4'
213+ os : ' ubuntu-latest'
200214 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.
201224 - php : ' 7.2'
225+ os : ' ubuntu-latest'
202226 custom_ini : true
203- - php : ' 8.4'
204- custom_ini : false
205227
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' }})"
207230
208231 steps :
209232 - name : Checkout code
210233 uses : actions/checkout@v4
211234
212235 - name : Setup ini config
236+ if : ${{ matrix.os != 'windows-latest' }}
213237 id : set_ini
238+ shell : bash
214239 run : |
215240 # 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"
223243 fi
224244
225245 - name : Install PHP
226246 uses : shivammathur/setup-php@v2
227247 with :
228248 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 }}
230250 coverage : xdebug
231251
232252 # This action also handles the caching of the dependencies.
@@ -254,38 +274,47 @@ jobs:
254274
255275 - name : Grab PHPUnit version
256276 id : phpunit_version
277+ shell : bash
257278 # 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"
259280
260281 - name : " DEBUG: Show grabbed version"
261282 run : echo ${{ steps.phpunit_version.outputs.VERSION }}
262283
263284 - 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
265286
266287 # PHPUnit 9.3 started using PHP-Parser for code coverage, which can cause issues due to Parser
267288 # also polyfilling PHP tokens.
268289 # As of PHPUnit 9.3.4, a cache warming option is available.
269290 # Using that option prevents issues with PHP-Parser backfilling PHP tokens during our test runs.
270291 - name : " Warm the PHPUnit cache (PHPUnit 9.3+)"
271292 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
273294
274295 - 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
277298
278299 - 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
281310
282311 - name : Upload coverage results to Coveralls
283312 if : ${{ success() }}
284313 uses : coverallsapp/github-action@v2
285314 with :
286315 format : clover
287316 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 }}
289318 parallel : true
290319
291320 coveralls-finish :
0 commit comments