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: env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist" 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: jobs:
tests: tests:
@ -68,6 +70,30 @@ jobs:
- name: "Checkout" - name: "Checkout"
uses: "actions/checkout@v2" 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" - name: "Install PHP"
uses: "shivammathur/setup-php@v2" uses: "shivammathur/setup-php@v2"
with: with:
@ -87,28 +113,29 @@ jobs:
key: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}-${{ hashFiles('**/composer.lock') }}" 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 }}" 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" - name: "Handle lowest dependencies update"
if: "matrix.dependencies == 'highest'" if: "contains(matrix.dependencies, 'lowest')"
run: "composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }}" 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" - name: "Handle ignore-platform-reqs dependencies update"
if: "matrix.dependencies == 'highest-ignore'" if: "contains(matrix.dependencies, 'ignore')"
run: "composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }} --ignore-platform-reqs" 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" - name: "Remove platform config to get latest dependencies for current PHP version when build is not locked"
if: "matrix.dependencies == 'lowest'" run: "composer config platform --unset"
run: "composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest"
- name: "Install lowest dependencies from composer.json using composer binary provided by system, ignoring platform requirements" - name: "Update dependencies from composer.json using composer binary provided by system"
if: "matrix.dependencies == 'lowest-ignore'" if: "contains(matrix.dependencies, 'highest') || contains(matrix.dependencies, 'lowest')"
run: "composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest --ignore-platform-reqs" run: "composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}"
- name: "Install dependencies from composer.lock using composer binary provided by system" - name: "Install dependencies from composer.lock using composer binary provided by system"
if: "matrix.dependencies == 'locked'" if: "matrix.dependencies == 'locked'"
run: "composer install ${{ env.COMPOSER_FLAGS }}" 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" - name: "Run install again using composer binary from source"
if: "matrix.dependencies != 'highest-ignore'"
run: "bin/composer install ${{ env.COMPOSER_FLAGS }}" run: "bin/composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Validate composer.json" - name: "Validate composer.json"
@ -117,21 +144,15 @@ jobs:
- name: "Prepare git environment" - name: "Prepare git environment"
run: "git config --global user.name composer && git config --global user.email composer@example.com" run: "git config --global user.name composer && git config --global user.email composer@example.com"
- name: "Set SYMFONY_PHPUNIT_VERSION environment variable" - name: "Pre-install PHPUnit using PHP 7.4 for PHP 8"
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"
if: "matrix.php-version == '8.0'" if: "matrix.php-version == '8.0'"
run: | run: |
bin/composer remove --dev symfony/phpunit-bridge --ignore-platform-reqs php7.4 vendor/bin/simple-phpunit install
bin/composer require phpunit/phpunit:^7.5 --ignore-platform-reqs --with-dependencies
vendor/bin/phpunit - 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": { "require": {
"php": "^5.3.2 || ^7.0", "php": "^5.3.2 || ^7.0",
"composer/ca-bundle": "^1.0", "composer/ca-bundle": "^1.0",
"composer/semver": "^2.0@dev", "composer/semver": "^2.1@dev",
"composer/spdx-licenses": "^1.2", "composer/spdx-licenses": "^1.2",
"composer/xdebug-handler": "^1.1", "composer/xdebug-handler": "^1.1",
"justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0",
"psr/log": "^1.0", "psr/log": "^1.0",
"seld/jsonlint": "^1.4", "seld/jsonlint": "^1.4",
"seld/phar-utils": "^1.0", "seld/phar-utils": "^1.0",
"symfony/console": "^2.7 || ^3.0 || ^4.0 || ^5.0", "symfony/console": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"symfony/filesystem": "^2.7 || ^3.0 || ^4.0 || ^5.0", "symfony/filesystem": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"symfony/finder": "^2.7 || ^3.0 || ^4.0 || ^5.0", "symfony/finder": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0", "symfony/process": "^2.8.52 || ^3.4 || ^4.4 || ^5.0",
"react/promise": "^1.2 || ^2.7" "react/promise": "^1.2 || ^2.7"
}, },
"conflict": { "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", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a5f07d1ae8479fae25dd57b2d966cd22", "content-hash": "4661f272e877e4aaaaf1cf0848b891b7",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -83,12 +83,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/semver.git", "url": "https://github.com/composer/semver.git",
"reference": "594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89" "reference": "07a3e324e654298714fcecfbb4604e3ee0c6f3bd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89", "url": "https://api.github.com/repos/composer/semver/zipball/07a3e324e654298714fcecfbb4604e3ee0c6f3bd",
"reference": "594e5242ff1ba3aac2f4b8401d3f1ca1d781fd89", "reference": "07a3e324e654298714fcecfbb4604e3ee0c6f3bd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -96,7 +96,7 @@
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^0.12.19", "phpstan/phpstan": "^0.12.19",
"phpunit/phpunit": "^4.5 || ^5.0.5 || ^7" "symfony/phpunit-bridge": "^4.2 || ^5"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -156,7 +156,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-05-19T14:49:33+00:00" "time": "2020-05-20T08:27:54+00:00"
}, },
{ {
"name": "composer/spdx-licenses", "name": "composer/spdx-licenses",

View File

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

View File

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

View File

@ -46,7 +46,11 @@ class ErrorHandlerTest extends TestCase
*/ */
public function testErrorHandlerCaptureWarning() 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'); array_merge(array(), 'string');
} }

View File

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