Skip to content

Commit

Permalink
Build tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed May 20, 2020
1 parent 0a4df6c commit 4e1f8cf
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 41 deletions.
73 changes: 47 additions & 26 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -117,21 +144,15 @@ jobs:
- name: "Prepare git environment"
run: "git config --global user.name composer && git config --global user.email [email protected]"

- name: "Set SYMFONY_PHPUNIT_VERSION environment variable"
if: "matrix.php-version == '7.4'"
run: "echo \"::set-env name=SYMFONY_PHPUNIT_VERSION::7.5\""
- name: "Pre-install PHPUnit using PHP 7.4 for PHP 8"
if: "matrix.php-version == '8.0'"
run: |
php7.4 vendor/bin/simple-phpunit install
- name: "Run tests"
if: "matrix.php-version != '8.0' && matrix.php-version != '7.3'"
if: "matrix.php-version != '7.3'"
run: "vendor/bin/simple-phpunit"

- name: "Run Complete test suite"
- name: "Run complete test suite on 7.3"
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'"
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
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
strict="false"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
Expand Down
2 changes: 1 addition & 1 deletion tests/Composer/Test/IO/ConsoleIOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testWriteWithMultipleLineStringWhenDebugging()
->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;
}),
Expand Down
6 changes: 5 additions & 1 deletion tests/Composer/Test/Util/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public function testErrorHandlerCaptureNotice()
*/
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');
}
Expand Down
1 change: 0 additions & 1 deletion tests/complete.phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
strict="false"
processIsolation="false"
stopOnFailure="false"
bootstrap="./bootstrap.php"
Expand Down

0 comments on commit 4e1f8cf

Please sign in to comment.