From 58e762435714586ac567a10daa808df5f4d8dfd0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 11 May 2021 18:06:27 +0200 Subject: [PATCH] [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 --- ...tor_run.yaml => along_other_packages.yaml} | 30 +++++------- .../.github/workflows/e2e.yaml | 48 ++++++++----------- .../.github/workflows/php8_attributes.yaml | 21 -------- .../.github/workflows/php_parser_3.yaml | 25 ---------- .../e2e/attributes/composer.json | 5 ++ .../attributes/rector.php} | 4 +- .../attributes/src}/route.php | 0 .../Component/Routing/Annotation/Route.php | 0 .../e2e/finalize/composer.json | 10 ++++ .../finalize/rector.php} | 1 - .../finalize/src}/SkipSomeEntity.php | 2 +- .../src}/SomeClassWithoutChildren.php | 2 +- .../composer.json | 0 .../rector.php | 0 .../src/Foo.php | 0 composer.json | 2 +- phpstan-for-rector.neon | 2 +- .../src/PhpScoper/StaticEasyPrefixer.php | 2 +- 18 files changed, 54 insertions(+), 100 deletions(-) rename build/target-repository/.github/workflows/{rector_run.yaml => along_other_packages.yaml} (65%) delete mode 100644 build/target-repository/.github/workflows/php8_attributes.yaml delete mode 100644 build/target-repository/.github/workflows/php_parser_3.yaml create mode 100644 build/target-repository/e2e/attributes/composer.json rename build/target-repository/{ci/rector-attributes.php => e2e/attributes/rector.php} (75%) rename build/target-repository/{tests/fixture-php8-attributes => e2e/attributes/src}/route.php (100%) rename build/target-repository/{ => e2e/attributes}/stubs/Symfony/Component/Routing/Annotation/Route.php (100%) create mode 100644 build/target-repository/e2e/finalize/composer.json rename build/target-repository/{ci/rector-finalize.php => e2e/finalize/rector.php} (91%) rename build/target-repository/{tests/fixture-finalize => e2e/finalize/src}/SkipSomeEntity.php (74%) rename build/target-repository/{tests/fixture-finalize => e2e/finalize/src}/SomeClassWithoutChildren.php (63%) rename build/target-repository/e2e/{parser-php8-code => parse-php8-code}/composer.json (100%) rename build/target-repository/e2e/{parser-php8-code => parse-php8-code}/rector.php (100%) rename build/target-repository/e2e/{parser-php8-code => parse-php8-code}/src/Foo.php (100%) diff --git a/build/target-repository/.github/workflows/rector_run.yaml b/build/target-repository/.github/workflows/along_other_packages.yaml similarity index 65% rename from build/target-repository/.github/workflows/rector_run.yaml rename to build/target-repository/.github/workflows/along_other_packages.yaml index 69e05a5278f..3465ac77301 100644 --- a/build/target-repository/.github/workflows/rector_run.yaml +++ b/build/target-repository/.github/workflows/along_other_packages.yaml @@ -1,4 +1,4 @@ -name: Rector Run +name: Along Other Packages on: pull_request: null @@ -7,7 +7,7 @@ on: - main jobs: - rector_run: + along_other_packages: runs-on: ubuntu-latest strategy: @@ -15,22 +15,18 @@ jobs: matrix: php_version: ['7.1', '7.2', '7.3', '7.4', '8.0'] commands: - - - name: 'Finalize Entity' - install: composer require doctrine/orm - run: vendor/bin/rector process ../tests/fixture-finalize --config ../ci/rector-finalize.php --ansi - - name: 'Composer Dependency' - install: composer require symfony/console 2.8 + install: composer require symfony/console:2.8 --ansi run: vendor/bin/rector list --debug --ansi + - + name: 'PHP Parser 3.1' + install: composer require nikic/php-parser:^3.1 --ansi + - name: 'Along PHPStan' 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 }}" @@ -42,19 +38,19 @@ jobs: php-version: ${{ matrix.php_version }} coverage: none + # wait for deploy to packagist + - run: sleep 70 + - run: | mkdir standalone cd standalone - # wait for deploy to packagist - sleep 70 - run: | - cd standalone # run composer require rector/rector:dev-main --dev --ansi ${{ matrix.commands.install }} + working-directory: standalone - - run: | - cd standalone - ${{ matrix.commands.run }} + run: vendor/bin/rector list --ansi + working-directory: standalone diff --git a/build/target-repository/.github/workflows/e2e.yaml b/build/target-repository/.github/workflows/e2e.yaml index 6a59a1d8e5d..b0cd9010e7a 100644 --- a/build/target-repository/.github/workflows/e2e.yaml +++ b/build/target-repository/.github/workflows/e2e.yaml @@ -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 on: @@ -12,39 +15,28 @@ jobs: strategy: fail-fast: false 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: - uses: actions/checkout@v2 - uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php }} - coverage: none # disable xdebug, pcov - - # 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: Generate Composer autoloaders in fixture directories - run: | - for FIXTURE in `find e2e -mindepth 1 -maxdepth 1 -type d`; do - (cd $FIXTURE; composer install --no-progress --ansi) - done - - - name: Run system tests - run: | - HAS_FAILURES=0 + php-version: ${{ matrix.php_version }} + coverage: none - 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 + - + run: composer install --ansi + working-directory: ${{ matrix.directory }} - exit $HAS_FAILURES + - + run: ../../bin/rector process --dry-run --ansi + working-directory: ${{ matrix.directory }} diff --git a/build/target-repository/.github/workflows/php8_attributes.yaml b/build/target-repository/.github/workflows/php8_attributes.yaml deleted file mode 100644 index 4132adfa0f0..00000000000 --- a/build/target-repository/.github/workflows/php8_attributes.yaml +++ /dev/null @@ -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 diff --git a/build/target-repository/.github/workflows/php_parser_3.yaml b/build/target-repository/.github/workflows/php_parser_3.yaml deleted file mode 100644 index 58c20db43e1..00000000000 --- a/build/target-repository/.github/workflows/php_parser_3.yaml +++ /dev/null @@ -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 diff --git a/build/target-repository/e2e/attributes/composer.json b/build/target-repository/e2e/attributes/composer.json new file mode 100644 index 00000000000..a8d803fa520 --- /dev/null +++ b/build/target-repository/e2e/attributes/composer.json @@ -0,0 +1,5 @@ +{ + "autoload-dev": { + "directories": ["stubs"] + } +} diff --git a/build/target-repository/ci/rector-attributes.php b/build/target-repository/e2e/attributes/rector.php similarity index 75% rename from build/target-repository/ci/rector-attributes.php rename to build/target-repository/e2e/attributes/rector.php index 908c41af6b5..f2ea9e04f5d 100644 --- a/build/target-repository/ci/rector-attributes.php +++ b/build/target-repository/e2e/attributes/rector.php @@ -7,12 +7,10 @@ use Rector\Symfony\Set\SymfonySetList; 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 { $containerConfigurator->import(SymfonySetList::SYMFONY_52); $parameters = $containerConfigurator->parameters(); $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80); + $parameters->set(Option::SOURCE, [__DIR__ . '/src']); }; diff --git a/build/target-repository/tests/fixture-php8-attributes/route.php b/build/target-repository/e2e/attributes/src/route.php similarity index 100% rename from build/target-repository/tests/fixture-php8-attributes/route.php rename to build/target-repository/e2e/attributes/src/route.php diff --git a/build/target-repository/stubs/Symfony/Component/Routing/Annotation/Route.php b/build/target-repository/e2e/attributes/stubs/Symfony/Component/Routing/Annotation/Route.php similarity index 100% rename from build/target-repository/stubs/Symfony/Component/Routing/Annotation/Route.php rename to build/target-repository/e2e/attributes/stubs/Symfony/Component/Routing/Annotation/Route.php diff --git a/build/target-repository/e2e/finalize/composer.json b/build/target-repository/e2e/finalize/composer.json new file mode 100644 index 00000000000..cebce1733e6 --- /dev/null +++ b/build/target-repository/e2e/finalize/composer.json @@ -0,0 +1,10 @@ +{ + "autoload": { + "psr-4": { + "Rector\\e2e\\": "src" + } + }, + "require-dev": { + "doctrine/orm": "^2.7" + } +} diff --git a/build/target-repository/ci/rector-finalize.php b/build/target-repository/e2e/finalize/rector.php similarity index 91% rename from build/target-repository/ci/rector-finalize.php rename to build/target-repository/e2e/finalize/rector.php index a61198407c6..290907417b1 100644 --- a/build/target-repository/ci/rector-finalize.php +++ b/build/target-repository/e2e/finalize/rector.php @@ -2,7 +2,6 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; diff --git a/build/target-repository/tests/fixture-finalize/SkipSomeEntity.php b/build/target-repository/e2e/finalize/src/SkipSomeEntity.php similarity index 74% rename from build/target-repository/tests/fixture-finalize/SkipSomeEntity.php rename to build/target-repository/e2e/finalize/src/SkipSomeEntity.php index ee06f874e0e..11baf123bec 100644 --- a/build/target-repository/tests/fixture-finalize/SkipSomeEntity.php +++ b/build/target-repository/e2e/finalize/src/SkipSomeEntity.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Rector\RectorPrefixed\Tests; +namespace Rector\e2e; use Doctrine\ORM\Mapping as ORM; diff --git a/build/target-repository/tests/fixture-finalize/SomeClassWithoutChildren.php b/build/target-repository/e2e/finalize/src/SomeClassWithoutChildren.php similarity index 63% rename from build/target-repository/tests/fixture-finalize/SomeClassWithoutChildren.php rename to build/target-repository/e2e/finalize/src/SomeClassWithoutChildren.php index 97f0ab37e31..63989d7fc48 100644 --- a/build/target-repository/tests/fixture-finalize/SomeClassWithoutChildren.php +++ b/build/target-repository/e2e/finalize/src/SomeClassWithoutChildren.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Rector\RectorPrefixed\Tests; +namespace Rector\e2e; class SomeClassWithoutChildren { diff --git a/build/target-repository/e2e/parser-php8-code/composer.json b/build/target-repository/e2e/parse-php8-code/composer.json similarity index 100% rename from build/target-repository/e2e/parser-php8-code/composer.json rename to build/target-repository/e2e/parse-php8-code/composer.json diff --git a/build/target-repository/e2e/parser-php8-code/rector.php b/build/target-repository/e2e/parse-php8-code/rector.php similarity index 100% rename from build/target-repository/e2e/parser-php8-code/rector.php rename to build/target-repository/e2e/parse-php8-code/rector.php diff --git a/build/target-repository/e2e/parser-php8-code/src/Foo.php b/build/target-repository/e2e/parse-php8-code/src/Foo.php similarity index 100% rename from build/target-repository/e2e/parser-php8-code/src/Foo.php rename to build/target-repository/e2e/parse-php8-code/src/Foo.php diff --git a/composer.json b/composer.json index 72999191c1a..d740ea2ecd2 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ }, "require-dev": { "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-nette": "^0.12.16", + "phpstan/phpstan-nette": "^0.12.18", "phpunit/phpunit": "^9.5", "rector/rector-generator": "^0.1.7", "rector/phpstan-rules": "^0.2.4", diff --git a/phpstan-for-rector.neon b/phpstan-for-rector.neon index 12e920de682..fc3f352636a 100644 --- a/phpstan-for-rector.neon +++ b/phpstan-for-rector.neon @@ -10,7 +10,7 @@ parameters: disableRuntimeReflectionProvider: true 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-rules/config/services/services.neon diff --git a/utils/compiler/src/PhpScoper/StaticEasyPrefixer.php b/utils/compiler/src/PhpScoper/StaticEasyPrefixer.php index 60b549fe77d..013617b2c17 100644 --- a/utils/compiler/src/PhpScoper/StaticEasyPrefixer.php +++ b/utils/compiler/src/PhpScoper/StaticEasyPrefixer.php @@ -17,7 +17,7 @@ final class StaticEasyPrefixer // for SmartFileInfo 'Symplify\SmartFileSystem\SmartFileInfo', // for ComposerJson because it is part of the public API. I.e. ComposerRectorInterface - 'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson' + 'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson', ]; /**