Skip to content

Commit

Permalink
CI: update for PHPUnit 10.0.0 support
Browse files Browse the repository at this point in the history
As the PHPUnit Polyfills, as of now, will officially support PHPUnit 10.x, with the exception of the TestListeners, the GH Actions workflow should be updated to reflect this.

This commit:
* Add builds for PHP 8.1 and 8.2 against low PHPUnit 10 versions.
    The "high" versions are automatically sorted via the matrix `auto` setting in combination with the Composer PHPUnit version requirements being widened.
* Add an extra experimental build against PHP 8.3 to ensure both PHPUnit 9.x as well as PHPUnit 10.x is tested with PHP 8.3.
* Update the experimental build against "future" PHPUnit to point to the `main` branch of PHPUnit.

Additionally, it updates the step which ran a "trial" build against PHPUnit 10 by splitting it into two steps: one with and one without coverage. Both are still allowed to fail when running the experimental build against PHPUnit `dev-main`.
  • Loading branch information
jrfnl committed Jun 6, 2023
1 parent f57e797 commit 235514b
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ jobs:
include:
# Test against a version on the low-end of the PHPUnit versions supported for each PHP version.
# Using the Composer `--prefer-lowest` option is, unfortunately, not viable, as
# PHPUnit 4.8.36 doesn't have proper PHP restrictions, which means that it
# would always be installed as "low", which would break the builds for PHP 7.2+.
# it would result PHP 5.6 - 7.4 all using PHPUnit 5.7.21, which is not the intention.
# It also would run into trouble with PHP 8.5.12 being used on PHP 8.0+, while the
# 8.5.12 release still contained a bug which makes it incompatible with PHP 8.1+,
# even though it officially allows for it..
- php: '5.6'
phpunit: '5.7.21'
coverage: true
Expand Down Expand Up @@ -67,23 +69,33 @@ jobs:
phpunit: '9.3.0'
coverage: true
experimental: false
- php: '8.1'
# Specifically set at 10.0.12 minimum to prevent needing a toggle in the tests for something
# related to the ArrayIsList polyfill, but not necessarily relevant.
phpunit: '10.0.12'
coverage: true
experimental: false
- php: '8.2'
phpunit: '9.3.0'
coverage: true
experimental: false
- php: '8.2'
phpunit: '10.1.0'
coverage: true
experimental: false

# Experimental builds.
- php: '8.3'
phpunit: 'auto' # PHPUnit 9.x.
phpunit: '^9.6'
coverage: false
experimental: true

- php: '8.1'
phpunit: '^10.0'
- php: '8.3'
phpunit: 'auto' # PHPUnit 10.x.
coverage: false
experimental: true

- php: '8.2'
phpunit: '^10.0'
phpunit: 'dev-main'
coverage: false
experimental: true

Expand Down Expand Up @@ -135,14 +147,21 @@ jobs:
run: composer test

- name: "Run the unit tests with code coverage (PHPUnit < 10)"
if: ${{ matrix.coverage == true && ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
if: ${{ matrix.coverage == true && ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer coverage

- name: "Trial run the unit tests against PHPUnit 10.0"
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
continue-on-error: true
- name: "Run the unit tests (PHPUnit 10.0+)"
if: ${{ matrix.coverage == false && startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
# Don't fail the build on a test run failure against a future PHPUnit version.
continue-on-error: ${{ matrix.phpunit == 'dev-main' }}
run: composer test10

- name: "Run the unit tests with code coverage (PHPUnit 10.0+)"
if: ${{ matrix.coverage == true && startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
# Don't fail the build on a test run failure against a future PHPUnit version.
continue-on-error: ${{ matrix.phpunit == 'dev-main' }}
run: composer coverage10

# PHP Coveralls doesn't fully support PHP 8.x yet, so switch the PHP version.
- name: Switch to PHP 7.4
if: ${{ success() && matrix.coverage == true && startsWith( matrix.php, '8' ) }}
Expand Down

0 comments on commit 235514b

Please sign in to comment.