From 8d05e4e18d782a664e4dae04423f8bcf6ebe2ea4 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 12 Jan 2025 22:16:12 +0100 Subject: [PATCH] Composer/GH Actions: allow for PHPUnit 12.x PHPUnit 12.0 has been released today. As the PHPUnit Polyfills, as of now, will officially support PHPUnit 12.x (with the exception of the TestListeners), the GH Actions workflow should be updated to reflect this. This commit: * Allows for PHPUnit 12 in the `composer.json` `require`. * Add builds for PHP 8.3 and 8.4 against low PHPUnit 12 versions for the Composer based tests. The "high" versions are automatically sorted via the matrix `auto` setting in combination with the Composer PHPUnit version requirements being widened. * Add builds for PHP 8.3 and 8.4 against high/low PHPUnit 12 for the PHAR based tests. * Add an extra experimental build in both test workflows against PHP "nightly" to ensure both PHPUnit 9.x, 11.x, as well as PHPUnit 12.x are tested with PHP 8.5. Refs: * https://phpunit.de/announcements/phpunit-12.html * https://github.com/sebastianbergmann/phpunit/blob/12.0/ChangeLog-12.0.md --- .github/workflows/test.yml | 36 +++++++++++++++++++++++++++++++++--- composer.json | 6 +++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a227e3c..9eb6b5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,10 +96,18 @@ jobs: phpunit: '11.0.0' coverage: true experimental: false + - php: '8.3' + phpunit: '12.0.0' + coverage: true + experimental: false - php: '8.4' phpunit: '11.3.6' coverage: true experimental: false + - php: '8.4' + phpunit: '12.0.0' + coverage: true + experimental: false # Experimental builds. - php: 'nightly' @@ -107,12 +115,16 @@ jobs: coverage: false experimental: true - php: 'nightly' - phpunit: 'auto' # PHPUnit 11.x. + phpunit: '^11.5' + coverage: false + experimental: true + - php: 'nightly' + phpunit: 'auto' # PHPUnit 12.x. coverage: false experimental: true - php: 'latest' - phpunit: 'dev-main' # PHPUnit 12.x. + phpunit: 'dev-main' # PHPUnit 12.x/13.x. coverage: false experimental: true @@ -168,6 +180,8 @@ jobs: run: | if [ "${{ matrix.phpunit == 'dev-main' }}" == "true" ]; then echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT" + elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '12.' ) }}" == "true" ]; then + echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT" elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT" else @@ -287,11 +301,25 @@ jobs: phpunit: '11' coverage: true + # PHPUnit 12 is fully supported for the officially supported PHP versions. + - php: '8.3' + phpunit: '12.0' + - php: '8.3' + phpunit: '12' + coverage: true + - php: '8.4' + phpunit: '12.0' + - php: '8.4' + phpunit: '12' + coverage: true + # Experimental builds. - php: 'nightly' phpunit: '9' - php: 'nightly' phpunit: '11' + - php: 'nightly' + phpunit: '12' name: "PHAR test: PHP ${{ matrix.php }} - PHPUnit: ${{matrix.phpunit}}" @@ -348,7 +376,9 @@ jobs: - name: Determine PHPUnit config id: phpunit_config run: | - if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then + if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '12.' ) }}" == "true" ]; then + echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT" + elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then echo 'FILE=phpunit10.xml.dist' >> "$GITHUB_OUTPUT" else echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT" diff --git a/composer.json b/composer.json index 488db00..7c70d13 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ }, "require": { "php": ">=7.1", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.0 || ^11.0" + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.0 || ^11.0 || ^12.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", @@ -90,7 +90,7 @@ "fix-cs": "Auto-fix code style violations in the PHP files.", "test": "Run the unit tests without code coverage (PHPUnit < 10).", "coverage": "Run the unit tests with code coverage (PHPUnit < 10).", - "test10": "Run the unit tests without code coverage using the PHPUnit 10/11 configuration file.", - "coverage10": "Run the unit tests with code coverage using the PHPUnit 10/11 configuration file." + "test10": "Run the unit tests without code coverage using the PHPUnit 10/11/12 configuration file.", + "coverage10": "Run the unit tests with code coverage using the PHPUnit 10/11/12 configuration file." } }