1
0
Fork 0

Merge pull request #8918 from Seldaek/build-improvements

Fix php8 builds
pull/8920/head
Jordi Boggiano 2020-05-20 17:13:31 +02:00 committed by GitHub
commit 2f5bf5c0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 68 additions and 45 deletions

View File

@ -10,7 +10,9 @@ on:
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
SYMFONY_PHPUNIT_VERSION: ""
COMPOSER_UPDATE_FLAGS: ""
SYMFONY_PHPUNIT_VERSION: "8.3"
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
jobs:
tests:
@ -68,6 +70,30 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP 7.4 to prepare nightly builds"
if: "matrix.php-version == '8.0'"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl"
ini-values: "memory_limit=-1, phar.readonly=0"
php-version: "7.4"
- name: "Choose PHPUnit version"
if: "!startsWith(matrix.os, 'windows')"
run: |
if [ "${{ matrix.php-version }}" = "5.3" ] || [ "${{ matrix.php-version }}" = "5.4" ] || [ "${{ matrix.php-version }}" = "5.5" ]; then
echo "::set-env name=SYMFONY_PHPUNIT_VERSION::4.8";
elif [ "${{ matrix.php-version }}" = "5.6" ]; then
echo "::set-env name=SYMFONY_PHPUNIT_VERSION::5.7";
elif [ "${{ matrix.php-version }}" = "7.0" ]; then
echo "::set-env name=SYMFONY_PHPUNIT_VERSION::6.5";
elif [ "${{ matrix.php-version }}" = "7.1" ]; then
echo "::set-env name=SYMFONY_PHPUNIT_VERSION::7.5";
else
echo "::set-env name=SYMFONY_PHPUNIT_VERSION::8.3";
fi
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
@ -87,28 +113,29 @@ jobs:
key: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}"
- name: "Install highest dependencies from composer.json using composer binary provided by system"
if: "matrix.dependencies == 'highest'"
run: "composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }}"
- name: "Handle lowest dependencies update"
if: "contains(matrix.dependencies, 'lowest')"
run: "echo \"::set-env name=COMPOSER_UPDATE_FLAGS::$COMPOSER_UPDATE_FLAGS --prefer-lowest\""
- name: "Install highest dependencies from composer.json using composer binary provided by system, ignoring platform requirements"
if: "matrix.dependencies == 'highest-ignore'"
run: "composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }} --ignore-platform-reqs"
- name: "Handle ignore-platform-reqs dependencies update"
if: "contains(matrix.dependencies, 'ignore')"
run: "echo \"::set-env name=COMPOSER_FLAGS::$COMPOSER_FLAGS --ignore-platform-reqs\""
- name: "Install lowest dependencies from composer.json using composer binary provided by system"
if: "matrix.dependencies == 'lowest'"
run: "composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest"
- name: "Remove platform config to get latest dependencies for current PHP version when build is not locked"
run: "composer config platform --unset"
- name: "Install lowest dependencies from composer.json using composer binary provided by system, ignoring platform requirements"
if: "matrix.dependencies == 'lowest-ignore'"
run: "composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest --ignore-platform-reqs"
- name: "Update dependencies from composer.json using composer binary provided by system"
if: "contains(matrix.dependencies, 'highest') || contains(matrix.dependencies, 'lowest')"
run: "composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}"
- name: "Install dependencies from composer.lock using composer binary provided by system"
if: "matrix.dependencies == 'locked'"
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Update Symfony's PHPUnitBridge to latest available for the current PHP always as it is not really a dependency of the project"
run: "composer update ${{ env.COMPOSER_FLAGS }} symfony/phpunit-bridge"
- name: "Run install again using composer binary from source"
if: "matrix.dependencies != 'highest-ignore'"
run: "bin/composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Validate composer.json"
@ -117,21 +144,15 @@ jobs:
- name: "Prepare git environment"
run: "git config --global user.name composer && git config --global user.email composer@example.com"
- name: "Set SYMFONY_PHPUNIT_VERSION environment variable"
if: "matrix.php-version == '7.4'"
run: "echo \"::set-env name=SYMFONY_PHPUNIT_VERSION::7.5\""
- name: "Run tests"
if: "matrix.php-version != '8.0' && matrix.php-version != '7.3'"
run: "vendor/bin/simple-phpunit"
- name: "Run Complete test suite"
if: "matrix.php-version == '7.3'"
run: "vendor/bin/simple-phpunit --configuration tests/complete.phpunit.xml"
- name: "Run tests for PHP 8"
- name: "Pre-install PHPUnit using PHP 7.4 for PHP 8"
if: "matrix.php-version == '8.0'"
run: |
bin/composer remove --dev symfony/phpunit-bridge --ignore-platform-reqs
bin/composer require phpunit/phpunit:^7.5 --ignore-platform-reqs --with-dependencies
vendor/bin/phpunit
php7.4 vendor/bin/simple-phpunit install
- name: "Run tests"
if: "matrix.php-version != '7.3'"
run: "vendor/bin/simple-phpunit"
- name: "Run complete test suite on 7.3"
if: "matrix.php-version == '7.3'"
run: "vendor/bin/simple-phpunit --configuration tests/complete.phpunit.xml"

View File

@ -24,17 +24,17 @@
"require": {
"php": "^5.3.2 || ^7.0",
"composer/ca-bundle": "^1.0",
"composer/semver": "^2.0@dev",
"composer/semver": "^2.1@dev",
"composer/spdx-licenses": "^1.2",
"composer/xdebug-handler": "^1.1",
"justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0",
"psr/log": "^1.0",
"seld/jsonlint": "^1.4",
"seld/phar-utils": "^1.0",
"symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0",
"symfony/console": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"symfony/filesystem": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"symfony/finder": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"symfony/process": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"react/promise": "^1.2 || ^2.7"
},
"conflict": {

12
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a5f07d1ae8479fae25dd57b2d966cd22",
"content-hash": "4661f272e877e4aaaaf1cf0848b891b7",
"packages": [
{
"name": "composer/ca-bundle",
@ -83,12 +83,12 @@
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89"
"reference": "07a3e324e654298714fcecfbb4604e3ee0c6f3bd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89",
"reference": "594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89",
"url": "https://api.github.com/repos/composer/semver/zipball/07a3e324e654298714fcecfbb4604e3ee0c6f3bd",
"reference": "07a3e324e654298714fcecfbb4604e3ee0c6f3bd",
"shasum": ""
},
"require": {
@ -96,7 +96,7 @@
},
"require-dev": {
"phpstan/phpstan": "^0.12.19",
"phpunit/phpunit": "^4.5 || ^5.0.5 || ^7"
"symfony/phpunit-bridge": "^4.2 || ^5"
},
"type": "library",
"extra": {
@ -156,7 +156,7 @@
"type": "tidelift"
}
],
"time": "2020-05-19T14:49:33+00:00"
"time": "2020-05-20T08:27:54+00:00"
},
{
"name": "composer/spdx-licenses",

View File

@ -10,7 +10,6 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
strict="false"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"

View File

@ -84,7 +84,7 @@ class ConsoleIOTest extends TestCase
->with(
$this->callback(function ($messages) {
$result = preg_match("[(.*)/(.*) First line]", $messages[0]) > 0;
$result &= preg_match("[(.*)/(.*) Second line]", $messages[1]) > 0;
$result = $result && preg_match("[(.*)/(.*) Second line]", $messages[1]) > 0;
return $result;
}),

View File

@ -46,7 +46,11 @@ class ErrorHandlerTest extends TestCase
*/
public function testErrorHandlerCaptureWarning()
{
$this->setExpectedException('\ErrorException', 'array_merge');
if (PHP_VERSION_ID >= 80000) {
$this->setExpectedException('TypeError', 'array_merge');
} else {
$this->setExpectedException('ErrorException', 'array_merge');
}
array_merge(array(), 'string');
}

View File

@ -10,7 +10,6 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
strict="false"
processIsolation="false"
stopOnFailure="false"
bootstrap="./bootstrap.php"