Skip to content

Create test database so that warming up the cache works. #1234

Create test database so that warming up the cache works.

Create test database so that warming up the cache works. #1234

Workflow file for this run

name: CI
on:
# Run CI every night at 2am
schedule:
- cron: 0 2 * * *
# Run CI on every Pull Request
pull_request: ~
# Run CI only on push on develop branch
push:
workflow_dispatch:
env:
PHP_VERSION: 8.4
permissions:
contents: read
jobs:
phpcpd:
name: PHPCPD
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Run phpcpd tests
run: vendor/bin/phpcpd src --exclude=src/Entity --exclude=src/Repository
tests:
name: Tests
runs-on: ubuntu-latest
env:
DOCKER_API_VERSION: '1.44'
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xdebug, xml, xmlwriter, xsl, zip
coverage: xdebug
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Run phpunit tests
run: bin/phpunit --coverage-text --coverage-xml=build/logs/phpunit/coverage-xml --coverage-clover=build/logs/phpunit/clover.xml --log-junit=build/logs/phpunit/junit.xml --colors=never --order-by=random --exclude-group=integration
- name: Run Infection tests
run: vendor/bin/infection --skip-initial-tests --coverage=build/logs/phpunit --min-covered-msi=80 --threads=30
- name: Install MariaDB
uses: getong/mariadb-action@v1.11
with:
mysql database: 'bewelcome_test'
mysql user: 'bewelcome'
mysql password: 'bewelcome'
- name: Create test database
run: bin/console test:database:create --env=test
- name: Warmup cache
run: bin/console cache:clear --env=test
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install bun dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # tag=v4.0.0
with:
timeout_minutes: 10
max_attempts: 5
retry_wait_seconds: 15
command: bun i --frozen-lockfile
- name: Run webpack
run: bun encore dev
- name: Run Integration tests
run: bin/phpunit --log-junit=build/logs/phpunit/integration.xml --colors=never --order-by=random --group=integration
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # tag=v7.0.1
if: ${{ always() }}
with:
name: infection.log
path: infection.log
phploc:
name: PHPLoc
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Run phploc
run: vendor/bin/phploc --log-xml=phploc.xml src tests
phpstan:
name: PHPStan (experimental)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-interaction --no-scripts
- name: Install MariaDB
uses: getong/mariadb-action@v1.11
with:
mysql database: 'bewelcome_test'
mysql user: 'bewelcome'
mysql password: 'bewelcome'
- name: Create test database
run: bin/console test:database:create --env=test
- name: Warmup cache
run: bin/console cache:clear --env=test
- name: Run phpstan
continue-on-error: true
run: vendor/bin/phpstan
# phpmd:
# name: PHPMD
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
#
# - name: Setup PHP
# uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
# with:
# php-version: ${{ env.PHP_VERSION }}
# extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
#
# - name: Get Composer Cache Directory
# id: composer-cache
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
#
# - name: Cache dependencies
# uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
# restore-keys: ${{ runner.os }}-composer-
#
# - name: Install project dependencies
# run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
#
# - name: Run phpmd tests
# run: vendor/bin/phpmd src,tests text phpmd.xml
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Run php-cs-fixer tests
run: vendor/bin/php-cs-fixer fix -v --diff --dry-run
php-code-sniffer:
name: PHP-Code-Sniffer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Run php-code-sniffer tests
run: vendor/bin/phpcs --colors --warning-severity=Error
lint-yaml:
name: Lint YAML
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Run Linter
run: bin/console lint:yaml --parse-tags config fixtures
doctrine-schema-validator:
name: Validate Doctrine schema
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Validate Doctrine schema
run: bin/console doctrine:schema:validate --skip-sync
security:
name: Security checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # tag=2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: curl, dom, gd, iconv, intl, json, libxml, mbstring, mysqli, pcntl, pdo_mysql, phar, tokenizer, xml, xmlwriter, xsl, zip
tools: symfony
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # tag=v5.0.5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
- name: Install bun dependencies
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # tag=v4.0.0
with:
timeout_minutes: 10
max_attempts: 5
retry_wait_seconds: 15
command: bun i --frozen-lockfile
- name: Run PHP security checker
run: symfony security:check
- name: Run JS security checker
run: bun audit