Skip to content

Commit be92a4b

Browse files
committed
GH Actions: run tests on Windows too
For the `quicktest` and the `coverage` jobs, only select tests which are marked with `@group Windows` will be run. For the "normal " `test` job, all tests will now be run on Windows too.
1 parent a220c80 commit be92a4b

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

.github/workflows/quicktest.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ jobs:
2323
# These are basically the same builds as in the Test->Coverage workflow, but then without doing
2424
# the code-coverage.
2525
quicktest:
26-
runs-on: ubuntu-latest
26+
runs-on: ${{ matrix.os }}
2727

2828
strategy:
2929
matrix:
30+
os: ['ubuntu-latest', 'windows-latest']
3031
php: ['5.4', '7.2', 'latest']
3132

32-
name: "QuickTest: PHP ${{ matrix.php }}"
33+
name: "QuickTest: PHP ${{ matrix.php }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
3334

3435
steps:
3536
- name: Checkout code
@@ -53,9 +54,14 @@ jobs:
5354
- name: 'PHPCS: set the path to PHP'
5455
run: php bin/phpcs --config-set php_path php
5556

56-
- name: 'PHPUnit: run the tests'
57+
- name: 'PHPUnit: run the full test suite'
58+
if: ${{ matrix.os != 'windows-latest' }}
5759
run: vendor/bin/phpunit tests/AllTests.php --no-coverage
5860

61+
- name: 'PHPUnit: run tests which may have different outcomes on Windows'
62+
if: ${{ matrix.os == 'windows-latest' }}
63+
run: vendor/bin/phpunit tests/AllTests.php --group Windows --no-coverage
64+
5965
# Note: The code style check is run as an integration test.
6066
- name: 'PHPCS: check code style without cache, no parallel'
6167
run: php bin/phpcs --no-cache --parallel=1

.github/workflows/test.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ 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

@@ -105,7 +106,7 @@ jobs:
105106
- php: '7.0'
106107
custom_ini: true
107108

108-
name: "PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
109+
name: "PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
109110

110111
continue-on-error: ${{ matrix.php == '8.5' }}
111112

@@ -162,7 +163,7 @@ jobs:
162163
- name: 'PHPCS: set the path to PHP'
163164
run: php bin/phpcs --config-set php_path php
164165

165-
- name: 'PHPUnit: run the tests without code coverage'
166+
- name: 'PHPUnit: run the full test suite without code coverage'
166167
if: ${{ matrix.skip_tests != true }}
167168
run: vendor/bin/phpunit tests/AllTests.php --no-coverage
168169

@@ -191,19 +192,20 @@ jobs:
191192
run: php phpcs.phar
192193

193194
coverage:
194-
runs-on: ubuntu-latest
195+
runs-on: ${{ matrix.os }}
195196

196197
strategy:
197198
matrix:
199+
os: ['ubuntu-latest', 'windows-latest']
200+
php: ['5.4', '8.4']
201+
custom_ini: [false]
202+
198203
include:
199-
- php: '5.4'
200-
custom_ini: false
201204
- php: '7.2'
205+
os: 'ubuntu-latest'
202206
custom_ini: true
203-
- php: '8.4'
204-
custom_ini: false
205207

206-
name: "Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
208+
name: "Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
207209

208210
steps:
209211
- name: Checkout code
@@ -272,20 +274,28 @@ jobs:
272274
run: vendor/bin/phpunit --coverage-cache ./build/phpunit-cache --warm-coverage-cache
273275

274276
- name: "Run the unit tests with code coverage (PHPUnit < 9.3)"
275-
if: ${{ steps.phpunit_version.outputs.VERSION < '9.3' }}
277+
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
276278
run: vendor/bin/phpunit tests/AllTests.php
277279

278280
- name: "Run the unit tests with code coverage (PHPUnit 9.3+)"
279-
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
281+
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
280282
run: vendor/bin/phpunit tests/AllTests.php --coverage-cache ./build/phpunit-cache
281283

284+
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit < 9.3)"
285+
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
286+
run: vendor/bin/phpunit tests/AllTests.php --group Windows
287+
288+
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit 9.3+)"
289+
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
290+
run: vendor/bin/phpunit tests/AllTests.php --group Windows --coverage-cache ./build/phpunit-cache
291+
282292
- name: Upload coverage results to Coveralls
283293
if: ${{ success() }}
284294
uses: coverallsapp/github-action@v2
285295
with:
286296
format: clover
287297
file: build/logs/clover.xml
288-
flag-name: php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
298+
flag-name: os-${{ matrix.os }}-php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
289299
parallel: true
290300

291301
coveralls-finish:

0 commit comments

Comments
 (0)