Skip to content

Commit d5cf3ab

Browse files
committed
GH Actions/coverage: join some steps
The "coverage" job basically runs the tests in three different ways: 1. Normal test run on Linux. 2. CBF specific tests in CBF mode on Linux. 3. Windows specific tests on Windows. For these three test runs, the script contained 6 steps as whether or not the coverage cache should be used depends on the PHPUnit version. This commit condenses the 6 steps to 3 steps by using a command inline expression instead of step conditions.
1 parent 5d1a922 commit d5cf3ab

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -294,37 +294,26 @@ jobs:
294294
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
295295
run: php "vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache --warm-coverage-cache
296296

297-
- name: "Run the unit tests with code coverage (PHPUnit < 9.3)"
298-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
299-
run: php "vendor/bin/phpunit"
300-
301-
- name: "Run the unit tests with code coverage (PHPUnit 9.3+)"
302-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
303-
run: php "vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache
304-
305-
- name: "Run select tests in CBF mode with code coverage (PHPUnit < 9.3)"
306-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
297+
- name: "Run the unit tests with code coverage"
298+
if: ${{ matrix.os != 'windows-latest' }}
307299
run: >
308-
php "vendor/bin/phpunit" tests/AllTests.php
309-
--group CBF --exclude-group nothing --coverage-clover build/logs/clover-cbf.xml
310-
env:
311-
PHP_CODESNIFFER_CBF: '1'
300+
php "vendor/bin/phpunit"
301+
${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
312302
313-
- name: "Run select tests in CBF mode with code coverage (PHPUnit 9.3+)"
314-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
303+
- name: "Run select tests in CBF mode with code coverage"
304+
if: ${{ matrix.os != 'windows-latest' }}
315305
run: >
316-
php "vendor/bin/phpunit" tests/AllTests.php --coverage-cache ./build/phpunit-cache
306+
php "vendor/bin/phpunit"
307+
${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
317308
--group CBF --exclude-group nothing --coverage-clover build/logs/clover-cbf.xml
318309
env:
319310
PHP_CODESNIFFER_CBF: '1'
320311

321-
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit < 9.3)"
322-
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
323-
run: php "vendor/bin/phpunit" --group Windows
324-
325-
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit 9.3+)"
326-
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
327-
run: php "vendor/bin/phpunit" --group Windows --coverage-cache ./build/phpunit-cache
312+
- name: "Run the unit tests which may have different outcomes on Windows with code coverage"
313+
if: ${{ matrix.os == 'windows-latest' }}
314+
run: >
315+
php "vendor/bin/phpunit" --group Windows
316+
${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
328317
329318
- name: "Upload coverage results to Coveralls (normal run)"
330319
if: ${{ success() }}

0 commit comments

Comments
 (0)