Skip to content

Commit

Permalink
[scoped] Run e2e parallel, suck in existing tests (#16)
Browse files Browse the repository at this point in the history
* run e2e in parallel

* [build] run e2e test in parlalel, explicit test list and merge with existing
  • Loading branch information
TomasVotruba committed May 11, 2021
1 parent 8de10f6 commit 58e7624
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 100 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rector Run
name: Along Other Packages

on:
pull_request: null
Expand All @@ -7,30 +7,26 @@ on:
- main

jobs:
rector_run:
along_other_packages:
runs-on: ubuntu-latest

strategy:
fail-fast: false
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 }}"

Expand All @@ -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
48 changes: 20 additions & 28 deletions build/target-repository/.github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}
21 changes: 0 additions & 21 deletions build/target-repository/.github/workflows/php8_attributes.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions build/target-repository/.github/workflows/php_parser_3.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions build/target-repository/e2e/attributes/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autoload-dev": {
"directories": ["stubs"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
};
10 changes: 10 additions & 0 deletions build/target-repository/e2e/finalize/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"autoload": {
"psr-4": {
"Rector\\e2e\\": "src"
}
},
"require-dev": {
"doctrine/orm": "^2.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Rector\RectorPrefixed\Tests;
namespace Rector\e2e;

use Doctrine\ORM\Mapping as ORM;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Rector\RectorPrefixed\Tests;
namespace Rector\e2e;

class SomeClassWithoutChildren
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion phpstan-for-rector.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/compiler/src/PhpScoper/StaticEasyPrefixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

/**
Expand Down

0 comments on commit 58e7624

Please sign in to comment.