fix(symfony): use static variable to store Error #2472
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
commitlint: | |
if: github.event_name == 'pull_request' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Run commitlint | |
run: | | |
commit=$(gh api \ | |
/repos/${{ github.repository }}/pulls/${{github.event.number}}/commits \ | |
| jq -r '.[0].commit.message' \ | |
| head -n 1) | |
# we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613 | |
echo '{}' > package.json | |
npm install --no-fund --no-audit @commitlint/config-conventional @commitlint/cli | |
echo $commit | ./node_modules/.bin/commitlint -g .commitlintrc | |
php-cs-fixer: | |
name: PHP CS Fixer (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
ini-values: memory_limit=-1 | |
tools: pecl, composer, php-cs-fixer | |
coverage: none | |
- name: Run PHP-CS-Fixer fix | |
run: php-cs-fixer fix --dry-run --diff --ansi | |
phpstan: | |
name: PHPStan (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_DEBUG: '1' # https://github.com/phpstan/phpstan-symfony/issues/37 | |
SYMFONY_PHPUNIT_VERSION: '9.5' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Cache PHPStan results | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/phpstan | |
key: phpstan-php${{ matrix.php }}-${{ github.sha }} | |
restore-keys: | | |
phpstan-php${{ matrix.php }}- | |
phpstan- | |
continue-on-error: true | |
- name: Clear test app cache | |
run: | | |
rm -Rf tests/Fixtures/app/var/cache/* | |
tests/Fixtures/app/console cache:warmup | |
- name: Run PHPStan analysis | |
env: | |
SYMFONY_PHPUNIT_VERSION: '9.5' | |
run: | | |
./vendor/bin/phpstan --version | |
./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi | |
phpunit: | |
name: PHPUnit (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
include: | |
- php: '8.1' | |
coverage: true | |
- php: '8.2' | |
coverage: true | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }} | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: phpunit-logs-php${{ matrix.php }} | |
path: build/logs/phpunit | |
continue-on-error: true | |
- name: Upload coverage results to Codecov | |
if: matrix.coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: build/logs/phpunit | |
name: phpunit-php${{ matrix.php }} | |
flags: phpunit | |
fail_ci_if_error: true | |
continue-on-error: true | |
- name: Upload coverage results to Coveralls | |
if: matrix.coverage | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml | |
continue-on-error: true | |
phpunit-components: | |
name: PHPUnit ${{ matrix.component }} (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
component: | |
- JsonSchema | |
- OpenApi | |
- Metadata | |
- Elasticsearch | |
- HttpCache | |
- RamseyUuid | |
- GraphQl | |
- Serializer | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: latest | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb | |
ini-values: memory_limit=-1 | |
- name: Run ${{ matrix.component }} tests | |
working-directory: src/${{ matrix.component }} | |
run: | | |
composer update | |
vendor/bin/simple-phpunit | |
behat: | |
name: Behat (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
include: | |
- php: '8.1' | |
coverage: true | |
- php: '8.2' | |
coverage: true | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests (PHP ${{ matrix.php }}) | |
run: | | |
mkdir -p build/logs/behat | |
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --no-interaction ${{ matrix.coverage && '--profile=default-coverage' || '--profile=default' }} | |
- name: Merge code coverage reports | |
if: matrix.coverage | |
run: | | |
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar | |
chmod +x /usr/local/bin/phpcov | |
mkdir -p build/coverage | |
phpcov merge --clover build/logs/behat/clover.xml build/coverage | |
continue-on-error: true | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: behat-logs-php${{ matrix.php }} | |
path: build/logs/behat | |
continue-on-error: true | |
- name: Upload coverage results to Codecov | |
if: matrix.coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: build/logs/behat | |
name: behat-php${{ matrix.php }} | |
flags: behat | |
fail_ci_if_error: true | |
continue-on-error: true | |
- name: Upload coverage results to Coveralls | |
if: matrix.coverage | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
php-coveralls --coverage_clover=build/logs/behat/clover.xml | |
continue-on-error: true | |
- name: Export OpenAPI documents | |
run: | | |
mkdir -p build/out/openapi | |
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json | |
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Validate OpenAPI documents | |
run: | | |
npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.json | |
npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.yaml | |
- name: Upload OpenAPI artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openapi-docs-php${{ matrix.php }} | |
path: build/out/openapi | |
continue-on-error: true | |
postgresql: | |
name: Behat (PHP ${{ matrix.php }}) (PostgreSQL) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: postgres | |
DATABASE_URL: postgres://api_platform:apiplatformrocks@localhost/api_platform_test | |
PGPASSWORD: apiplatformrocks | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup postgres | |
run: | | |
sudo systemctl start postgresql | |
sudo -u postgres psql -d template1 -c "CREATE USER api_platform WITH PASSWORD 'apiplatformrocks' CREATEDB" | |
createdb -h localhost -p 5432 -U api_platform api_platform_test | |
pg_isready -d api_platform_test -h localhost -p 5432 -U api_platform | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_pgsql, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: | | |
vendor/bin/behat --out=std --format=progress --profile=postgres --no-interaction -vv | |
mysql: | |
name: Behat (PHP ${{ matrix.php }}) (MySQL) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
services: | |
mysql: | |
image: mariadb:10.5.9 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: api_platform_test | |
ports: | |
- 3306:3306 | |
env: | |
APP_ENV: mysql | |
DATABASE_URL: mysql://root:[email protected]/api_platform_test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_mysql, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction --tags '~@!mysql' | |
mongodb: | |
name: PHPUnit + Behat (PHP ${{ matrix.php }}) (MongoDB) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: mongodb | |
MONGODB_URL: mongodb://localhost:27017 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup MongoDB | |
run: | | |
sudo apt update | |
sudo apt install -y wget gnupg | |
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |
sudo apt update | |
sudo apt install -y mongodb-org | |
sudo systemctl start mongod | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: | | |
composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --coverage-clover build/logs/phpunit/clover.xml --group mongodb | |
- name: Run Behat tests | |
run: | | |
mkdir -p build/logs/behat | |
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=mongodb-coverage --no-interaction | |
- name: Merge code coverage reports | |
run: | | |
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar | |
chmod +x /usr/local/bin/phpcov | |
mkdir -p build/coverage | |
phpcov merge --clover build/logs/behat/clover.xml build/coverage | |
continue-on-error: true | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: behat-logs-php${{ matrix.php }} | |
path: build/logs/behat | |
continue-on-error: true | |
- name: Upload coverage results to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: build/logs/behat | |
name: behat-php${{ matrix.php }} | |
flags: behat | |
fail_ci_if_error: true | |
continue-on-error: true | |
- name: Upload coverage results to Coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
php-coveralls --coverage_clover=build/logs/behat/clover.xml | |
continue-on-error: true | |
mercure: | |
name: PHPUnit + Behat (PHP ${{ matrix.php }}) (Mercure) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: mercure | |
MERCURE_URL: 'http://localhost:1337/.well-known/mercure' | |
MERCURE_JWT_SECRET: 'eyJhbGciOiJIUzI1NiJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdLCJzdWJzY3JpYmUiOlsiaHR0cHM6Ly9leGFtcGxlLmNvbS9teS1wcml2YXRlLXRvcGljIiwie3NjaGVtZX06Ly97K2hvc3R9L2RlbW8vYm9va3Mve2lkfS5qc29ubGQiLCIvLndlbGwta25vd24vbWVyY3VyZS9zdWJzY3JpcHRpb25zey90b3BpY317L3N1YnNjcmliZXJ9Il0sInBheWxvYWQiOnsidXNlciI6Imh0dHBzOi8vZXhhbXBsZS5jb20vdXNlcnMvZHVuZ2xhcyIsInJlbW90ZUFkZHIiOiIxMjcuMC4wLjEifX19.KKPIikwUzRuB3DTpVw6ajzwSChwFw5omBMmMcWKiDcM' | |
services: | |
mercure: | |
image: dunglas/mercure | |
env: | |
SERVER_NAME: :1337 | |
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!' | |
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!' | |
MERCURE_EXTRA_DIRECTIVES: | | |
# Custom directives, see https://mercure.rocks/docs/hub/config | |
anonymous | |
cors_origins * | |
ports: | |
- 1337:1337 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --coverage-clover build/logs/phpunit/clover.xml --group mercure | |
- name: Run Behat tests | |
run: | | |
mkdir -p build/logs/behat | |
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=mercure-coverage --no-interaction | |
- name: Merge code coverage reports | |
run: | | |
wget -qO /usr/local/bin/phpcov https://phar.phpunit.de/phpcov.phar | |
chmod +x /usr/local/bin/phpcov | |
mkdir -p build/coverage | |
phpcov merge --clover build/logs/behat/clover.xml build/coverage | |
continue-on-error: true | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: behat-logs-php${{ matrix.php }} | |
path: build/logs/behat | |
continue-on-error: true | |
- name: Upload coverage results to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: build/logs/behat | |
name: behat-php${{ matrix.php }} | |
flags: behat | |
fail_ci_if_error: true | |
continue-on-error: true | |
- name: Upload coverage results to Coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
php-coveralls --coverage_clover=build/logs/behat/clover.xml | |
continue-on-error: true | |
elasticsearch: | |
name: Behat (PHP ${{ matrix.php }}) (Elasticsearch) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: elasticsearch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Runs Elasticsearch | |
uses: elastic/elastic-github-actions/elasticsearch@master | |
with: | |
stack-version: '8.4.0' | |
security-enabled: false | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: vendor/bin/behat --out=std --format=progress --profile=elasticsearch --no-interaction | |
elasticsearch-lowest: | |
name: Behat (PHP ${{ matrix.php }}) (Elasticsearch 7) (Symfony lowest) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: elasticsearch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Runs Elasticsearch | |
uses: elastic/elastic-github-actions/elasticsearch@master | |
with: | |
stack-version: '7.6.0' | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --prefer-lowest --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: vendor/bin/behat --out=std --format=progress --profile=elasticsearch --no-interaction | |
phpunit-no-deprecations: | |
name: PHPUnit (PHP ${{ matrix.php }}) (no deprecations) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit | |
phpunit-symfony-next: | |
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony dev) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Allow unstable project dependencies | |
run: composer config minimum-stability dev | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Remove cache | |
run: rm -Rf tests/Fixtures/app/var/cache/* | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
# The PHPUnit Bridge doesn't support PHPUnit 10 yet: https://github.com/symfony/symfony/issues/49069 | |
run: vendor/bin/phpunit -c phpunit10.xml.dist | |
behat-symfony-next: | |
name: Behat (PHP ${{ matrix.php }}) (Symfony dev) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Install additional packages | |
run: sudo apt-get install moreutils | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Allow unstable project dependencies | |
run: composer config minimum-stability dev | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Remove cache | |
run: rm -Rf tests/Fixtures/app/var/cache/* | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction | |
windows-phpunit: | |
name: Windows PHPUnit (PHP ${{ matrix.php }}) (SQLite) | |
runs-on: windows-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: sqlite | |
DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP with pre-release PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install phpunit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml | |
env: | |
SYMFONY_DEPRECATIONS_HELPER: max[direct]=0&ignoreFile=./tests/.ignored-deprecations | |
windows-behat: | |
name: Windows Behat (PHP ${{ matrix.php }}) (SQLite) | |
runs-on: windows-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
env: | |
APP_ENV: sqlite | |
DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP with pre-release PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install phpunit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction | |
phpunit-symfony-lowest: | |
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony lowest) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Remove cache | |
run: rm -Rf tests/Fixtures/app/var/cache/* | |
- name: Update project dependencies | |
run: composer update --prefer-lowest --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: vendor/bin/simple-phpunit | |
env: | |
SYMFONY_DEPRECATIONS_HELPER: max[self]=0&ignoreFile=./tests/.ignored-deprecations | |
behat-symfony-lowest: | |
name: Behat (PHP ${{ matrix.php }}) (Symfony lowest) | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, mongodb | |
coverage: none | |
ini-values: memory_limit=-1 | |
- name: Install additional packages | |
run: sudo apt-get install moreutils | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Remove cache | |
run: rm -Rf tests/Fixtures/app/var/cache/* | |
- name: Update project dependencies | |
run: composer update --prefer-lowest --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests | |
run: vendor/bin/behat --out=std --format=progress --profile=default --no-interaction | |
phpunit_legacy: | |
name: PHPUnit Legacy event listeners (PHP ${{ matrix.php }}) | |
env: | |
EVENT_LISTENERS_BACKWARD_COMPATIBILITY_LAYER: 1 | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
include: | |
- php: '8.2' | |
coverage: true | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Enable code coverage | |
if: matrix.coverage | |
run: echo "COVERAGE=1" >> $GITHUB_ENV | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run PHPUnit tests | |
run: | | |
mkdir -p build/logs/phpunit | |
if [ "$COVERAGE" = '1' ]; then | |
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml --coverage-clover build/logs/phpunit/clover.xml | |
else | |
vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml | |
fi | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: phpunit-logs-php${{ matrix.php }} | |
path: build/logs/phpunit | |
continue-on-error: true | |
- name: Upload coverage results to Codecov | |
if: matrix.coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: build/logs/phpunit | |
name: phpunit-php${{ matrix.php }} | |
flags: phpunit | |
fail_ci_if_error: true | |
continue-on-error: true | |
- name: Upload coverage results to Coveralls | |
if: matrix.coverage | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls | |
export PATH="$PATH:$HOME/.composer/vendor/bin" | |
php-coveralls --coverage_clover=build/logs/phpunit/clover.xml | |
continue-on-error: true | |
behat_legacy: | |
name: Behat Legacy event listeners (PHP ${{ matrix.php }}) | |
env: | |
EVENT_LISTENERS_BACKWARD_COMPATIBILITY_LAYER: 1 | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
php: | |
- '8.2' | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl, composer | |
extensions: intl, bcmath, curl, openssl, mbstring, pdo_sqlite | |
coverage: pcov | |
ini-values: memory_limit=-1 | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Update project dependencies | |
run: composer update --no-interaction --no-progress --ansi | |
- name: Install PHPUnit | |
run: vendor/bin/simple-phpunit --version | |
- name: Clear test app cache | |
run: tests/Fixtures/app/console cache:clear --ansi | |
- name: Run Behat tests (PHP 8) | |
run: | | |
mkdir -p build/logs/behat | |
vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=legacy --no-interaction | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: behat-logs-php${{ matrix.php }} | |
path: build/logs/behat | |
continue-on-error: true | |
- name: Export OpenAPI documents | |
run: | | |
mkdir -p build/out/openapi | |
tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json | |
tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Validate OpenAPI documents | |
run: | | |
npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.json | |
npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.yaml | |
- name: Upload OpenAPI artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: openapi-docs-php${{ matrix.php }} | |
path: build/out/openapi | |
continue-on-error: true | |