Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Symfony 6 support and bump PHP to 7.4 #179

Merged
merged 1 commit into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
name: Build

on:
push: ~
pull_request: ~
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
Comment on lines -4 to -10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we bring it back?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

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: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
coverage: none

-
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

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: Install dependencies
run: composer update

-
name: Run analysis
run: composer analyse

-
name: Run tests
run: composer test
- name: Checkout
uses: actions/checkout@v2

- 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: Validate composer.json
run: composer validate --no-check-lock

- 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 install --prefer-dist --no-progress
env:
SYMFONY_REQUIRE: "${{ matrix.symfony-version }}"

- name: Run analysis
run: composer analyse
if: matrix.symfony-version != '6.0.*'

- name: Run tests
run: composer test
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
Expand All @@ -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
{
Expand All @@ -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
Expand All @@ -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
{
Expand All @@ -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:
Expand All @@ -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
{
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
Expand All @@ -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
{
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
<errorLevel type="suppress">
<referencedClass name="Symfony\Component\BrowserKit\AbstractBrowser" />
<referencedClass name="Symfony\Component\BrowserKit\Client" />
<referencedClass name="Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator" />
</errorLevel>
</UndefinedClass>
<InvalidAttribute>
<errorLevel type="suppress">
<file name="src/Mink/MinkParameters.php" />
</errorLevel>
</InvalidAttribute>
</issueHandlers>
</psalm>
13 changes: 10 additions & 3 deletions tests/Behat/Context/TestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class: App\Kernel
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
{
Expand All @@ -125,9 +125,16 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
$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
Expand Down