Application #1242
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: Application | |
on: | |
push: ~ | |
pull_request: ~ | |
release: | |
types: [created] | |
schedule: | |
- | |
cron: "0 1 * * 6" # Run at 1am every Saturday | |
jobs: | |
static-checks: | |
runs-on: ubuntu-latest | |
name: "Static checks (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ["8.2", "8.3"] | |
symfony: ["^6.4", "^7.1"] | |
node: ["14.x", "16.x"] | |
mysql: ["5.7"] | |
steps: | |
- | |
uses: actions/checkout@v2 | |
- | |
name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php }}" | |
ini-values: date.timezone=Europe/Warsaw | |
extensions: intl, gd, mysql, pdo_mysql | |
tools: symfony | |
coverage: none | |
- | |
name: Restrict Symfony version | |
if: matrix.symfony != '' | |
run: | | |
composer global config --no-plugins allow-plugins.symfony/flex true | |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.0" | |
composer config extra.symfony.require "${{ matrix.symfony }}" | |
- | |
name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- | |
name: Cache Composer | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- | |
- | |
name: Install PHP dependencies | |
run: composer update --no-interaction --no-scripts | |
id: end-of-setup | |
- | |
name: Validate composer.json | |
run: composer validate --strict | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Check for security vulnerabilities | |
run: symfony security:check | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Validate coding standard | |
run: make validate-coding-standard | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Validate Twig templates | |
run: make validate-twig || true | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Validate Yaml files | |
run: make validate-yaml-files | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Validate Package versions | |
run: make validate-package-version | |
- | |
name: Run Psalm | |
run: vendor/bin/psalm --show-info=false --php-version=${{ matrix.php }} | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Run PHPStan | |
run: vendor/bin/phpstan analyse | |
if: always() && steps.end-of-setup.outcome == 'success' | |
test-application: | |
runs-on: ubuntu-latest | |
name: "Test application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, Behat driver ${{ matrix.behat_driver }}), MySQL ${{ matrix.mysql }})" | |
timeout-minutes: 25 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ["8.2", "8.3"] | |
symfony: ["^6.4", "^7.1"] | |
node: ["16.x"] | |
mysql: ["5.7"] | |
behat_driver: ["panther"] | |
include: | |
- php: "8.2" | |
symfony: "^6.4" | |
node: "16.x" | |
mysql: "5.7" | |
behat_driver: "chrome" | |
- php: "8.2" | |
symfony: "^6.4" | |
node: "16.x" | |
mysql: "5.7" | |
behat_driver: "chrome_headless" | |
env: | |
APP_ENV: test | |
DATABASE_URL: "mysql://root:[email protected]/monofony?serverVersion=${{ matrix.mysql }}" | |
steps: | |
- | |
uses: actions/checkout@v2 | |
- | |
name: Shutdown default MySQL | |
run: sudo service mysql stop | |
- | |
name: Setup MySQL | |
uses: mirromutth/[email protected] | |
with: | |
mysql version: "${{ matrix.mysql }}" | |
mysql root password: "root" | |
- | |
name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php }}" | |
ini-values: date.timezone=Europe/Paris, opcache.enable=1, opcache.enable_cli=1, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 | |
extensions: intl, gd, opcache, mysql, pdo_mysql | |
tools: symfony | |
coverage: none | |
- | |
name: Restrict Symfony version | |
if: matrix.symfony != '' | |
run: | | |
composer global config --no-plugins allow-plugins.symfony/flex true | |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.0" | |
composer config extra.symfony.require "${{ matrix.symfony }}" | |
- | |
name: Install certificates | |
run: symfony server:ca:install | |
- | |
name: Configure Behat driver | |
run: | | |
sed -i -e 's/javascript_session: panther/javascript_session: ${{ matrix.behat_driver }}/g' behat.yml.dist | |
- | |
name: Run Chrome Headless | |
run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' https://127.0.0.1 > /dev/null 2>&1 & | |
- | |
name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- | |
name: Cache Composer | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- | |
- | |
name: Install PHP dependencies | |
run: composer update --no-interaction --no-scripts | |
- | |
name: Run Selenium | |
if: matrix.behat_driver == 'chrome' | |
run: vendor/bin/selenium-server-standalone -Dwebdriver.chrome.driver=drivers/chromedriver > /dev/null 2>&1 & | |
- | |
name: Install Behat driver | |
if: matrix.behat_driver != 'chrome_headless' | |
run: vendor/bin/bdi detect drivers | |
- | |
name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ matrix.node }}" | |
- | |
name: Get Yarn cache directory | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- | |
name: Cache Yarn | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ matrix.node }}-yarn- | |
- | |
name: Install JS dependencies | |
run: yarn install | |
- | |
name: Validate Yarn packages | |
run: yarn check | |
- | |
name: Dump the environment | |
run: | | |
echo "DATABASE_URL=$DATABASE_URL" >> .env.$APP_ENV | |
composer dump-env $APP_ENV | |
- | |
name: Warmup cache | |
run: bin/console cache:warmup | |
- | |
name: Run webserver | |
run: symfony server:start --port=8080 --dir=public --daemon | |
- | |
name: Prepare application database | |
run: | | |
APP_DEBUG=1 bin/console doctrine:database:create -vvv | |
bin/console doctrine:migrations:migrate -n -vvv | |
- | |
name: Build assets | |
run: | | |
bin/console assets:install public -vvv | |
yarn build | |
- | |
name: Validate Doctrine mapping | |
run: make validate-doctrine-schema | |
if: always() && steps.end-of-setup.outcome == 'success' | |
- | |
name: Test provided migrations | |
run: make test-doctrine-migrations | |
- | |
name: Test installer | |
run: make test-installer | |
- | |
name: Load fixtures | |
run: make test-fixtures | |
- | |
name: Run PHPSpec | |
run: make test-phpspec | |
- | |
name: Run PHPUnit | |
run: make test-phpunit | |
- | |
name: Run CLI Behat | |
run: make test-behat-with-cli | |
- | |
name: Run non-JS Behat | |
run: make test-behat-without-javascript | |
- | |
name: Run JS Behat | |
run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --rerun | |
- | |
name: Upload Behat logs | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "Behat logs (JS, PHP ${{ matrix.php }})" | |
path: etc/build/ | |
if-no-files-found: ignore | |
- | |
name: Upload Symfony logs | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: "Symfony logs (JS, PHP ${{ matrix.php }})" | |
path: var/log/ | |
if-no-files-found: ignore |