Skip to content

Commit f7dcac5

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 f7dcac5

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-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: 23 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,8 @@ jobs:
105106
- php: '7.0'
106107
custom_ini: true
107108

108-
name: "PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
109+
# yamllint disable-line rule:line-length
110+
name: "PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
109111

110112
continue-on-error: ${{ matrix.php == '8.5' }}
111113

@@ -162,7 +164,7 @@ jobs:
162164
- name: 'PHPCS: set the path to PHP'
163165
run: php bin/phpcs --config-set php_path php
164166

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

@@ -191,19 +193,21 @@ jobs:
191193
run: php phpcs.phar
192194

193195
coverage:
194-
runs-on: ubuntu-latest
196+
runs-on: ${{ matrix.os }}
195197

196198
strategy:
197199
matrix:
200+
os: ['ubuntu-latest', 'windows-latest']
201+
php: ['5.4', '8.4']
202+
custom_ini: [false]
203+
198204
include:
199-
- php: '5.4'
200-
custom_ini: false
201205
- php: '7.2'
206+
os: 'ubuntu-latest'
202207
custom_ini: true
203-
- php: '8.4'
204-
custom_ini: false
205208

206-
name: "Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
209+
# yamllint disable-line rule:line-length
210+
name: "Coverage: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }} (${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Win' }})"
207211

208212
steps:
209213
- name: Checkout code
@@ -272,20 +276,28 @@ jobs:
272276
run: vendor/bin/phpunit --coverage-cache ./build/phpunit-cache --warm-coverage-cache
273277

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

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

286+
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit < 9.3)"
287+
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
288+
run: vendor/bin/phpunit tests/AllTests.php --group Windows
289+
290+
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit 9.3+)"
291+
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
292+
run: vendor/bin/phpunit tests/AllTests.php --group Windows --coverage-cache ./build/phpunit-cache
293+
282294
- name: Upload coverage results to Coveralls
283295
if: ${{ success() }}
284296
uses: coverallsapp/github-action@v2
285297
with:
286298
format: clover
287299
file: build/logs/clover.xml
288-
flag-name: php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
300+
flag-name: os-${{ matrix.os }}-php-${{ matrix.php }}-custom-ini-${{ matrix.custom_ini }}
289301
parallel: true
290302

291303
coveralls-finish:

0 commit comments

Comments
 (0)