Skip to content

Commit 17e2796

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 f91c044 commit 17e2796

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -349,37 +349,26 @@ jobs:
349349
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
350350
run: php "vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache --warm-coverage-cache
351351

352-
- name: "Run the unit tests with code coverage (PHPUnit < 9.3)"
353-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
354-
run: php "vendor/bin/phpunit" tests/AllTests.php
355-
356-
- name: "Run the unit tests with code coverage (PHPUnit 9.3+)"
357-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
358-
run: php "vendor/bin/phpunit" tests/AllTests.php --coverage-cache ./build/phpunit-cache
359-
360-
- name: "Run select tests in CBF mode with code coverage (PHPUnit < 9.3)"
361-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
352+
- name: "Run the unit tests with code coverage"
353+
if: ${{ matrix.os != 'windows-latest' }}
362354
run: >
363355
php "vendor/bin/phpunit" tests/AllTests.php
364-
--group CBF --exclude-group nothing --coverage-clover build/logs/clover-cbf.xml
365-
env:
366-
PHP_CODESNIFFER_CBF: '1'
356+
${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
367357
368-
- name: "Run select tests in CBF mode with code coverage (PHPUnit 9.3+)"
369-
if: ${{ matrix.os != 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
358+
- name: "Run select tests in CBF mode with code coverage"
359+
if: ${{ matrix.os != 'windows-latest' }}
370360
run: >
371-
php "vendor/bin/phpunit" tests/AllTests.php --coverage-cache ./build/phpunit-cache
361+
php "vendor/bin/phpunit" tests/AllTests.php
362+
${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
372363
--group CBF --exclude-group nothing --coverage-clover build/logs/clover-cbf.xml
373364
env:
374365
PHP_CODESNIFFER_CBF: '1'
375366

376-
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit < 9.3)"
377-
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION < '9.3' }}
378-
run: php "vendor/bin/phpunit" tests/AllTests.php --group Windows
379-
380-
- name: "Run the unit tests which may have different outcomes on Windows with code coverage (PHPUnit 9.3+)"
381-
if: ${{ matrix.os == 'windows-latest' && steps.phpunit_version.outputs.VERSION >= '9.3' }}
382-
run: php "vendor/bin/phpunit" tests/AllTests.php --group Windows --coverage-cache ./build/phpunit-cache
367+
- name: "Run the unit tests which may have different outcomes on Windows with code coverage"
368+
if: ${{ matrix.os == 'windows-latest' }}
369+
run: >
370+
php "vendor/bin/phpunit" tests/AllTests.php --group Windows
371+
${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
383372
384373
- name: "Upload coverage results to Coveralls (normal run)"
385374
if: ${{ success() }}

0 commit comments

Comments
 (0)