Merge pull request #191 from mpdude/fix-build

Fix the build pipeline in GitHub Actions
This commit is contained in:
Yozhef
2022-11-26 09:28:13 +02:00
committed by GitHub
9 changed files with 101 additions and 28 deletions

View File

@@ -13,8 +13,7 @@ on:
jobs: jobs:
test: test:
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }} name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
continue-on-error: false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -24,7 +23,6 @@ jobs:
- '8.1' - '8.1'
symfony-version: symfony-version:
- '4.4.*' - '4.4.*'
- '5.3.*'
- '5.4.*' - '5.4.*'
- '6.0.*' - '6.0.*'
exclude: exclude:
@@ -32,29 +30,92 @@ jobs:
symfony-version: '6.0.*' symfony-version: '6.0.*'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
coverage: none coverage: none
ini-values: "memory_limit=-1" ini-values: "memory_limit=-1, zend.assertions=1"
php-version: ${{ matrix.php-version }} php-version: ${{ matrix.php-version }}
tools: composer:v2, flex tools: composer:v2, flex
# This works around SYMFONY_REQUIRE currently not working (https://github.com/symfony/flex/issues/946):
- name: Lock Symfony version
run: VERSION=${{ matrix.symfony-version }} .github/workflows/lock-symfony-version.sh
- name: Install dependencies
run: |
composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer install --prefer-dist --no-progress --no-plugins
#env:
# SYMFONY_REQUIRE: "${{ matrix.symfony-version }}"
- name: Run tests
run: composer test
psalm:
name: Run Psalm
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
ini-values: "memory_limit=-1, zend.assertions=1"
php-version: 7.4
tools: composer:v2, flex
- name: Install dependencies
run: |
composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer install --prefer-dist --no-progress --no-plugins
- name: Run Psalm
run: vendor/bin/psalm src --no-progress
validate-composer:
name: Validate composer.json
runs-on: ubuntu-22.04
continue-on-error: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
ini-values: "memory_limit=-1, zend.assertions=1"
php-version: 8.1
tools: composer:v2, flex
- name: Validate composer.json - name: Validate composer.json
run: composer validate --strict run: composer validate --strict
coding-standards:
name: Validate Coding Standards
runs-on: ubuntu-22.04
continue-on-error: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
ini-values: "memory_limit=-1, zend.assertions=1"
php-version: 8.1
tools: composer:v2, flex
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist --no-progress run: |
env: composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
SYMFONY_REQUIRE: "${{ matrix.symfony-version }}" composer install --prefer-dist --no-progress
- name: Run coding standard - name: Run coding standard
run: vendor/bin/ecs check --ansi --no-progress-bar src tests run: vendor/bin/ecs check --ansi --no-progress-bar src tests
- name: Run Psalm
run: vendor/bin/psalm src --no-progress --php-version="${{ matrix.php-version }}"
- name: Run tests
run: composer test

4
.github/workflows/lock-symfony-version.sh vendored Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
cat <<< $(jq --indent 4 --arg version $VERSION '.require |= with_entries(if (.key|test("^symfony/")) then .value=$version else . end)' < composer.json) > composer.json
cat <<< $(jq --indent 4 --arg version $VERSION '."require-dev" |= with_entries(if (.key|test("^symfony/")) then .value=$version else . end)' < composer.json) > composer.json

View File

@@ -24,7 +24,7 @@
"friends-of-behat/mink-extension": "^2.5", "friends-of-behat/mink-extension": "^2.5",
"friends-of-behat/page-object-extension": "^0.3.2", "friends-of-behat/page-object-extension": "^0.3.2",
"friends-of-behat/service-container-extension": "^1.1", "friends-of-behat/service-container-extension": "^1.1",
"sylius-labs/coding-standard": "^4.1.1", "sylius-labs/coding-standard": ">=4.1.1, <=4.2.1",
"symfony/browser-kit": "^4.4 || ^5.3 || ^6.0", "symfony/browser-kit": "^4.4 || ^5.3 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.3 || ^6.0", "symfony/framework-bundle": "^4.4 || ^5.3 || ^6.0",
"symfony/process": "^4.4 || ^5.3 || ^6.0", "symfony/process": "^4.4 || ^5.3 || ^6.0",

View File

@@ -48,6 +48,10 @@ Feature: Autowiring contexts
App\Tests\SomeContext: App\Tests\SomeContext:
public: true public: true
# https://github.com/symfony/symfony/pull/35879/
Psr\Container\ContainerInterface:
alias: service_container
""" """
When I run Behat When I run Behat
Then it should pass Then it should pass
@@ -128,6 +132,10 @@ Feature: Autowiring contexts
App\Tests\: App\Tests\:
resource: '../tests/*' resource: '../tests/*'
# https://github.com/symfony/symfony/pull/35879/
Psr\Container\ContainerInterface:
alias: service_container
""" """
When I run Behat When I run Behat
Then it should pass Then it should pass

View File

@@ -132,7 +132,7 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
throw new SuiteConfigurationException(sprintf( throw new SuiteConfigurationException(sprintf(
'"contexts" setting of the "%s" suite is expected to be an array, %s given.', '"contexts" setting of the "%s" suite is expected to be an array, %s given.',
$suite->getName(), $suite->getName(),
gettype($contexts) gettype($contexts),
), $suite->getName()); ), $suite->getName());
} }
@@ -147,7 +147,7 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
throw new SuiteConfigurationException(sprintf( throw new SuiteConfigurationException(sprintf(
'"contexts" setting of the "%s" suite is expected to be an array, %s given.', '"contexts" setting of the "%s" suite is expected to be an array, %s given.',
$suite->getName(), $suite->getName(),
gettype($contexts) gettype($contexts),
), $suite->getName()); ), $suite->getName());
} }
@@ -182,7 +182,7 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
throw new EnvironmentIsolationException(sprintf( throw new EnvironmentIsolationException(sprintf(
'"%s" does not support isolation of "%s" environment.', '"%s" does not support isolation of "%s" environment.',
static::class, static::class,
get_class($uninitializedEnvironment) get_class($uninitializedEnvironment),
), $uninitializedEnvironment); ), $uninitializedEnvironment);
} }
} }
@@ -197,7 +197,7 @@ final class ContextServiceEnvironmentHandler implements EnvironmentHandler
get_class($this->symfonyKernel), get_class($this->symfonyKernel),
$this->symfonyKernel->getEnvironment(), $this->symfonyKernel->getEnvironment(),
$this->symfonyKernel->isDebug() ? 'enabled' : 'disabled', $this->symfonyKernel->isDebug() ? 'enabled' : 'disabled',
FriendsOfBehatSymfonyExtensionBundle::class FriendsOfBehatSymfonyExtensionBundle::class,
)); ));
} }

View File

@@ -81,7 +81,7 @@ final class InitializedSymfonyExtensionEnvironment implements SymfonyExtensionEn
if (!isset($this->contexts[$class])) { if (!isset($this->contexts[$class])) {
throw new ContextNotFoundException(sprintf( throw new ContextNotFoundException(sprintf(
'`%s` context is not found in the suite environment. Have you registered it?', '`%s` context is not found in the suite environment. Have you registered it?',
$class $class,
), $class); ), $class);
} }

View File

@@ -19,7 +19,7 @@ final class SymfonyDriver extends BrowserKitDriver
'Please make sure the kernel is using "test" environment or have "framework.test" configuration option enabled.', 'Please make sure the kernel is using "test" environment or have "framework.test" configuration option enabled.',
get_class($kernel), get_class($kernel),
$kernel->getEnvironment(), $kernel->getEnvironment(),
$kernel->isDebug() ? 'enabled' : 'disabled' $kernel->isDebug() ? 'enabled' : 'disabled',
)); ));
} }
@@ -31,7 +31,7 @@ final class SymfonyDriver extends BrowserKitDriver
'Service "test.client" should be an instance of "%s" or "%s", "%s" given.', 'Service "test.client" should be an instance of "%s" or "%s", "%s" given.',
Client::class, Client::class,
AbstractBrowser::class, AbstractBrowser::class,
get_class($testClient) get_class($testClient),
)); ));
} }

View File

@@ -222,7 +222,7 @@ final class SymfonyExtension implements Extension
if ($autodiscovered !== 1) { if ($autodiscovered !== 1) {
throw new \RuntimeException( throw new \RuntimeException(
'Could not autodiscover the application kernel. ' . 'Could not autodiscover the application kernel. ' .
'Please define it manually with "FriendsOfBehat\SymfonyExtension.kernel" configuration option.' 'Please define it manually with "FriendsOfBehat\SymfonyExtension.kernel" configuration option.',
); );
} }
@@ -260,7 +260,7 @@ final class SymfonyExtension implements Extension
throw new \RuntimeException( throw new \RuntimeException(
'Could not autodiscover the bootstrap file. ' . 'Could not autodiscover the bootstrap file. ' .
'Please define it manually with "FriendsOfBehat\SymfonyExtension.bootstrap" configuration option. ' . 'Please define it manually with "FriendsOfBehat\SymfonyExtension.bootstrap" configuration option. ' .
'Setting that option to "false" disables autodiscovering.' 'Setting that option to "false" disables autodiscovering.',
); );
} }

View File

@@ -310,7 +310,7 @@ YML
} }
throw new \DomainException( throw new \DomainException(
'Behat was expecting to pass, but failed with the following output:' . \PHP_EOL . \PHP_EOL . $this->getProcessOutput() 'Behat was expecting to pass, but failed with the following output:' . \PHP_EOL . \PHP_EOL . $this->getProcessOutput(),
); );
} }
@@ -333,7 +333,7 @@ YML
} }
throw new \DomainException( throw new \DomainException(
'Behat was expecting to fail, but passed with the following output:' . \PHP_EOL . \PHP_EOL . $this->getProcessOutput() 'Behat was expecting to fail, but passed with the following output:' . \PHP_EOL . \PHP_EOL . $this->getProcessOutput(),
); );
} }
@@ -371,7 +371,7 @@ YML
throw new \DomainException(sprintf( throw new \DomainException(sprintf(
'Pattern "%s" does not match the following output:' . \PHP_EOL . \PHP_EOL . '%s', 'Pattern "%s" does not match the following output:' . \PHP_EOL . \PHP_EOL . '%s',
$pattern, $pattern,
$output $output,
)); ));
} }
} }