From f0addeadbe23ba69207c590ed1c84c83d21d42d8 Mon Sep 17 00:00:00 2001 From: Yoan Bernabeu Date: Sat, 21 Dec 2024 15:59:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20TEST:=20Update=20quality=20assur?= =?UTF-8?q?ance=20workflow=20with=20Docker=20and=20enhanced=20steps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/quality.yml | 80 +++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 3bd7e96..239f2e4 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -3,53 +3,81 @@ name: Quality Assurance on: push: pull_request: + branches: [ "main" ] jobs: static-code-analysis: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@master - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: pdo_sqlite - coverage: xdebug - - - name: Copy .env.test - run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');" - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Create Database + - name: Create Database Directory run: | - mkdir -p var/ + mkdir -p var touch var/test.db + chmod -R 777 var + + - name: Copy .env.test + run: cp .env.test .env.test.local - name: PHP CS Fixer - run: vendor/bin/php-cs-fixer fix ./src --rules=@Symfony --verbose --dry-run + uses: docker://jakzal/phpqa:php8.3 + with: + args: php-cs-fixer fix ./src --rules=@Symfony --verbose --dry-run - name: PHPStan - run: vendor/bin/phpstan analyse ./src --level=8 + uses: docker://jakzal/phpqa:php8.3 + with: + args: phpstan analyse ./src --level=8 - name: Security Check - run: vendor/bin/security-checker security:check + uses: docker://jakzal/phpqa:php8.3 + with: + args: local-php-security-checker - name: Lint Twig - run: php bin/console lint:twig ./templates + uses: docker://jakzal/phpqa:php8.3 + with: + args: bin/console lint:twig ./templates - name: Lint YAML - run: php bin/console lint:yaml ./config + uses: docker://jakzal/phpqa:php8.3 + with: + args: bin/console lint:yaml ./config - name: Lint Container - run: php bin/console lint:container + uses: docker://jakzal/phpqa:php8.3 + with: + args: bin/console lint:container - - name: Execute tests + - name: Create Database Schema + uses: docker://jakzal/phpqa:php8.3 env: DATABASE_URL: "sqlite:///%kernel.project_dir%/var/test.db" APP_ENV: test - run: | - php bin/console doctrine:schema:create --env=test - vendor/bin/phpunit --testdox \ No newline at end of file + with: + args: bin/console doctrine:schema:create --env=test + + - name: Run Migrations + uses: docker://jakzal/phpqa:php8.3 + env: + DATABASE_URL: "sqlite:///%kernel.project_dir%/var/test.db" + APP_ENV: test + with: + args: bin/console doctrine:migrations:migrate --no-interaction --env=test + + - name: Load Fixtures + uses: docker://jakzal/phpqa:php8.3 + env: + DATABASE_URL: "sqlite:///%kernel.project_dir%/var/test.db" + APP_ENV: test + with: + args: bin/console doctrine:fixtures:load --no-interaction --env=test + + - name: Run Tests + uses: docker://jakzal/phpqa:php8.3 + env: + DATABASE_URL: "sqlite:///%kernel.project_dir%/var/test.db" + APP_ENV: test + with: + args: bin/phpunit --testdox \ No newline at end of file