[scoped] Run e2e parallel, suck in existing tests (#16)

* run e2e in parallel

* [build] run e2e test in parlalel, explicit test list and merge with existing
This commit is contained in:
Tomas Votruba 2021-05-11 18:06:27 +02:00 committed by GitHub
parent 8de10f682a
commit 58e7624357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 54 additions and 100 deletions

View File

@ -1,4 +1,4 @@
name: Rector Run name: Along Other Packages
on: on:
pull_request: null pull_request: null
@ -7,7 +7,7 @@ on:
- main - main
jobs: jobs:
rector_run: along_other_packages:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -16,21 +16,17 @@ jobs:
php_version: ['7.1', '7.2', '7.3', '7.4', '8.0'] php_version: ['7.1', '7.2', '7.3', '7.4', '8.0']
commands: commands:
- -
name: 'Finalize Entity' name: 'Composer Dependency'
install: composer require doctrine/orm install: composer require symfony/console:2.8 --ansi
run: vendor/bin/rector process ../tests/fixture-finalize --config ../ci/rector-finalize.php --ansi run: vendor/bin/rector list --debug --ansi
- -
name: 'Composer Dependency' name: 'PHP Parser 3.1'
install: composer require symfony/console 2.8 install: composer require nikic/php-parser:^3.1 --ansi
run: vendor/bin/rector list --debug --ansi
- -
name: 'Along PHPStan' name: 'Along PHPStan'
install: composer require phpstan/phpstan:0.12.86 --dev --ansi install: composer require phpstan/phpstan:0.12.86 --dev --ansi
run: |
vendor/bin/rector list --ansi
vendor/bin/phpstan -h --ansi
name: "PHP ${{ matrix.php_version }}" name: "PHP ${{ matrix.php_version }}"
@ -42,19 +38,19 @@ jobs:
php-version: ${{ matrix.php_version }} php-version: ${{ matrix.php_version }}
coverage: none coverage: none
# wait for deploy to packagist
- run: sleep 70
- run: | - run: |
mkdir standalone mkdir standalone
cd standalone cd standalone
# wait for deploy to packagist
sleep 70
- run: | - run: |
cd standalone
# run # run
composer require rector/rector:dev-main --dev --ansi composer require rector/rector:dev-main --dev --ansi
${{ matrix.commands.install }} ${{ matrix.commands.install }}
working-directory: standalone
- -
run: | run: vendor/bin/rector list --ansi
cd standalone working-directory: standalone
${{ matrix.commands.run }}

View File

@ -1,3 +1,6 @@
# This workflow runs system tests: Use the Rector application from the source
# checkout to process "fixture" projects in tests/system-tests
# to see if those can be processed successfully
name: End to End tests name: End to End tests
on: on:
@ -12,39 +15,28 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php: ['7.4', '8.0'] php_version: ['7.1', '7.2', '7.3', '7.4', '8.0']
directory:
- 'e2e/attributes'
- 'e2e/dont-execute-code'
- 'e2e/finalize'
- 'e2e/parse-php7-code'
- 'e2e/parse-php8-code'
name: End to end test - ${{ matrix.directory }}
name: PHP ${{ matrix.php }} system tests
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2 - uses: shivammathur/setup-php@v2
with: with:
php-version: ${{ matrix.php }} php-version: ${{ matrix.php_version }}
coverage: none # disable xdebug, pcov coverage: none
# This workflow runs system tests: Use the Rector application from the source -
# checkout to process "fixture" projects in tests/system-tests run: composer install --ansi
# to see if those can be processed successfully working-directory: ${{ matrix.directory }}
- name: Generate Composer autoloaders in fixture directories -
run: | run: ../../bin/rector process --dry-run --ansi
for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do working-directory: ${{ matrix.directory }}
(cd $FIXTURE; composer install --no-progress --ansi)
done
- name: Run system tests
run: |
HAS_FAILURES=0
for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do
echo "-----> Running $FIXTURE <-----"
if (cd $FIXTURE; ../../bin/rector process --dry-run --clear-cache); then
echo "-----> Result: OK <-----"
else
echo "-----> Result: FAILED <-----"
HAS_FAILURES=1
fi
done
exit $HAS_FAILURES

View File

@ -1,21 +0,0 @@
name: PHP 8 Attributes
on:
pull_request: null
push:
branches:
- main
jobs:
php8_attributes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
- run: bin/rector process tests/fixture-php8-attributes --config ci/rector-attributes.php --ansi

View File

@ -1,25 +0,0 @@
name: PHP Parser 3
on:
pull_request: null
push:
branches:
- main
jobs:
php_parser_3:
runs-on: ubuntu-latest
steps:
-
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
coverage: none
# wait for deploy to packagist
- run: sleep 70
- run: composer require nikic/php-parser:^3.1 --ansi
- run: composer require rector/rector:dev-main --dev --ansi
- run: vendor/bin/rector list --ansi

View File

@ -0,0 +1,5 @@
{
"autoload-dev": {
"directories": ["stubs"]
}
}

View File

@ -7,12 +7,10 @@ use Rector\Core\ValueObject\PhpVersion;
use Rector\Symfony\Set\SymfonySetList; use Rector\Symfony\Set\SymfonySetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
// route class must exist and be loaded, as annotation parser uses dynamic reflection
require_once __DIR__ . '/../stubs/Symfony/Component/Routing/Annotation/Route.php';
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(SymfonySetList::SYMFONY_52); $containerConfigurator->import(SymfonySetList::SYMFONY_52);
$parameters = $containerConfigurator->parameters(); $parameters = $containerConfigurator->parameters();
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80); $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80);
$parameters->set(Option::SOURCE, [__DIR__ . '/src']);
}; };

View File

@ -0,0 +1,10 @@
{
"autoload": {
"psr-4": {
"Rector\\e2e\\": "src"
}
},
"require-dev": {
"doctrine/orm": "^2.7"
}
}

View File

@ -2,7 +2,6 @@
declare(strict_types=1); declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector; use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Rector\RectorPrefixed\Tests; namespace Rector\e2e;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Rector\RectorPrefixed\Tests; namespace Rector\e2e;
class SomeClassWithoutChildren class SomeClassWithoutChildren
{ {

View File

@ -53,7 +53,7 @@
}, },
"require-dev": { "require-dev": {
"phpstan/extension-installer": "^1.1", "phpstan/extension-installer": "^1.1",
"phpstan/phpstan-nette": "^0.12.16", "phpstan/phpstan-nette": "^0.12.18",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"rector/rector-generator": "^0.1.7", "rector/rector-generator": "^0.1.7",
"rector/phpstan-rules": "^0.2.4", "rector/phpstan-rules": "^0.2.4",

View File

@ -10,7 +10,7 @@ parameters:
disableRuntimeReflectionProvider: true disableRuntimeReflectionProvider: true
includes: includes:
- vendor/rector/rector-phpstan-rules/config/config.neon - vendor/rector/phpstan-rules/config/config.neon
- vendor/symplify/phpstan-extensions/config/config.neon - vendor/symplify/phpstan-extensions/config/config.neon
- vendor/symplify/phpstan-rules/config/services/services.neon - vendor/symplify/phpstan-rules/config/services/services.neon

View File

@ -17,7 +17,7 @@ final class StaticEasyPrefixer
// for SmartFileInfo // for SmartFileInfo
'Symplify\SmartFileSystem\SmartFileInfo', 'Symplify\SmartFileSystem\SmartFileInfo',
// for ComposerJson because it is part of the public API. I.e. ComposerRectorInterface // for ComposerJson because it is part of the public API. I.e. ComposerRectorInterface
'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson' 'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson',
]; ];
/** /**