diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7112157..4454322 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,56 +1,56 @@ name: Build on: - push: ~ - pull_request: ~ - release: - types: [created] - schedule: - - - cron: "0 1 * * 6" # Run at 1am every Saturday + push: + pull_request: + types: [opened, synchronize, edited, reopened] jobs: - tests: - runs-on: ubuntu-latest - name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + test: + name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }} + runs-on: ubuntu-20.04 + continue-on-error: false strategy: fail-fast: false matrix: - php: ["7.3", "7.4", "8.0", "8.1"] - symfony: ["4.4.*", "5.1.*"] - + php-version: + - '7.4' + - '8.0' + - '8.1' + symfony-version: + - '4.4.*' + - '5.4.*' + - '6.0.*' + exclude: + - php-version: '7.4' + symfony-version: '6.0.*' steps: - - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - coverage: none + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + coverage: none + ini-values: "memory_limit=-1" + php-version: ${{ matrix.php-version }} + tools: composer:v2, flex - - - name: Update Symfony version - if: matrix.symfony != '' - run: | - composer require symfony/dependency-injection:${{ matrix.symfony }} --no-update --no-scripts - composer require symfony/http-kernel:${{ matrix.symfony }} --no-update --no-scripts - composer require symfony/proxy-manager-bridge:${{ matrix.symfony }} --no-update --no-scripts + - name: Validate composer.json + run: composer validate --no-check-lock - composer require --dev symfony/browser-kit:${{ matrix.symfony }} --no-update --no-scripts - composer require --dev symfony/framework-bundle:${{ matrix.symfony }} --no-update --no-scripts - composer require --dev symfony/process:${{ matrix.symfony }} --no-update --no-scripts - composer require --dev symfony/yaml:${{ matrix.symfony }} --no-update --no-scripts + - name: Remove analysis dependencies + run: composer remove --dev --no-update sylius-labs/coding-standard vimeo/psalm + if: matrix.symfony-version == '6.0.*' - - - name: Install dependencies - run: composer update + - name: Install dependencies + run: composer install --prefer-dist --no-progress + env: + SYMFONY_REQUIRE: "${{ matrix.symfony-version }}" - - - name: Run analysis - run: composer analyse + - name: Run analysis + run: composer analyse + if: matrix.symfony-version != '6.0.*' - - - name: Run tests - run: composer test + - name: Run tests + run: composer test diff --git a/composer.json b/composer.json index 1ccd8e3..96baba4 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "behat/behat": "^3.6.1", - "symfony/dependency-injection": "^4.4 || ^5.1", - "symfony/http-kernel": "^4.4 || ^5.1", - "symfony/proxy-manager-bridge": "^4.4 || ^5.1" + "symfony/dependency-injection": "^4.4 || ^5.1 || ^6.0", + "symfony/http-kernel": "^4.4 || ^5.1 || ^6.0", + "symfony/proxy-manager-bridge": "^4.4 || ^5.1 || ^6.0" }, "require-dev": { "behat/mink-selenium2-driver": "^1.3", @@ -25,10 +25,10 @@ "friends-of-behat/page-object-extension": "^0.3.2", "friends-of-behat/service-container-extension": "^1.1", "sylius-labs/coding-standard": "^3.2", - "symfony/browser-kit": "^4.4 || ^5.1", - "symfony/framework-bundle": "^4.4 || ^5.1", - "symfony/process": "^4.4 || ^5.1", - "symfony/yaml": "^4.4 || ^5.1", + "symfony/browser-kit": "^4.4 || ^5.1 || ^6.0", + "symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0", + "symfony/process": "^4.4 || ^5.1 || ^6.0", + "symfony/yaml": "^4.4 || ^5.1 || ^6.0", "vimeo/psalm": "4.4.1" }, "suggest": { diff --git a/features/configuration/autodiscovering_application_kernel.feature b/features/configuration/autodiscovering_application_kernel.feature index 04b8dad..3f05539 100644 --- a/features/configuration/autodiscovering_application_kernel.feature +++ b/features/configuration/autodiscovering_application_kernel.feature @@ -61,7 +61,6 @@ Feature: Autodiscovering the application kernel use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel as HttpKernel; - use Symfony\Component\Routing\RouteCollectionBuilder; class Kernel extends HttpKernel { @@ -85,7 +84,7 @@ Feature: Autodiscovering the application kernel $loader->load(__DIR__ . '/../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void {} + protected function configureRoutes($routes): void {} } """ When I run Behat @@ -101,7 +100,6 @@ Feature: Autodiscovering the application kernel use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel as HttpKernel; - use Symfony\Component\Routing\RouteCollectionBuilder; class AppKernel extends HttpKernel { @@ -125,7 +123,7 @@ Feature: Autodiscovering the application kernel $loader->load(__DIR__ . '/../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void {} + protected function configureRoutes($routes): void {} } """ When I run Behat @@ -147,7 +145,6 @@ Feature: Autodiscovering the application kernel use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel as HttpKernel; - use Symfony\Component\Routing\RouteCollectionBuilder; class Kernel extends HttpKernel { @@ -171,7 +168,7 @@ Feature: Autodiscovering the application kernel $loader->load(__DIR__ . '/../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void {} + protected function configureRoutes($routes): void {} } """ And a kernel file "app/AppKernel.php" containing: @@ -183,7 +180,6 @@ Feature: Autodiscovering the application kernel use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel as HttpKernel; - use Symfony\Component\Routing\RouteCollectionBuilder; class AppKernel extends HttpKernel { @@ -207,7 +203,7 @@ Feature: Autodiscovering the application kernel $loader->load(__DIR__ . '/../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void {} + protected function configureRoutes($routes): void {} } """ When I run Behat diff --git a/features/configuration/loading_configured_application_kernel.feature b/features/configuration/loading_configured_application_kernel.feature index 67e6908..5dcb39b 100644 --- a/features/configuration/loading_configured_application_kernel.feature +++ b/features/configuration/loading_configured_application_kernel.feature @@ -66,7 +66,6 @@ Feature: Loading configured application kernel use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel as HttpKernel; - use Symfony\Component\Routing\RouteCollectionBuilder; class Kernel extends HttpKernel { @@ -90,7 +89,7 @@ Feature: Loading configured application kernel $loader->load(__DIR__ . '/../../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void {} + protected function configureRoutes($routes): void {} } """ When I run Behat @@ -115,7 +114,6 @@ Feature: Loading configured application kernel use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel as HttpKernel; - use Symfony\Component\Routing\RouteCollectionBuilder; class AppKernel extends HttpKernel { @@ -139,7 +137,7 @@ Feature: Loading configured application kernel $loader->load(__DIR__ . '/../../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void {} + protected function configureRoutes($routes): void {} } """ When I run Behat diff --git a/psalm.xml b/psalm.xml index fe98d98..38fcca1 100644 --- a/psalm.xml +++ b/psalm.xml @@ -19,7 +19,13 @@ + + + + + + diff --git a/tests/Behat/Context/TestContext.php b/tests/Behat/Context/TestContext.php index 5c2ed64..4e66d02 100644 --- a/tests/Behat/Context/TestContext.php +++ b/tests/Behat/Context/TestContext.php @@ -100,7 +100,7 @@ use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel as HttpKernel; -use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; class Kernel extends HttpKernel { @@ -125,9 +125,16 @@ class Kernel extends HttpKernel $loader->load(__DIR__ . '/../config/services.yaml'); } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes($routes): void { - $routes->add('/hello-world', 'App\Controller:helloWorld'); + if ($routes instanceof RoutingConfigurator) { // available since Symfony 5.1 + $routes + ->add('app_hello', '/hello-world') + ->controller('App\Controller::helloWorld') + ; + } else { // support Symfony 4.4 + $routes->add('/hello-world', 'App\Controller:helloWorld'); + } } } CON