mirror of
https://github.com/karatektus/pl_mail.git
synced 2026-10-25 01:54:10 +00:00
136 lines
4.9 KiB
YAML
136 lines
4.9 KiB
YAML
name: E2E
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
playwright:
|
|
name: Playwright
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
APP_ENV: test
|
|
APP_DEBUG: "1"
|
|
DATABASE_URL: "postgresql://app:app@127.0.0.1:5432/app?serverVersion=18&charset=utf8"
|
|
MESSENGER_TRANSPORT_DSN: "in-memory://"
|
|
MAILER_DSN: "null://null"
|
|
APP_DEV_USER_EMAIL: "e2e@plmail.test"
|
|
APP_DEV_USER_PASSWORD: "e2e-password-change-me"
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:18
|
|
env:
|
|
POSTGRES_USER: app
|
|
POSTGRES_PASSWORD: app
|
|
POSTGRES_DB: app
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U app"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP extension cache
|
|
id: php-extension-cache
|
|
uses: shivammathur/cache-extensions@v1
|
|
with:
|
|
php-version: "8.4"
|
|
extensions: ctype, iconv, pcntl, pdo_pgsql, pgsql, intl, sodium, mbstring, xml, curl, zip
|
|
key: php-extensions-v1
|
|
|
|
- name: Cache PHP extensions
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.php-extension-cache.outputs.dir }}
|
|
key: ${{ steps.php-extension-cache.outputs.key }}
|
|
restore-keys: ${{ steps.php-extension-cache.outputs.key }}
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "8.4"
|
|
extensions: ctype, iconv, pcntl, pdo_pgsql, pgsql, intl, sodium, mbstring, xml, curl, zip
|
|
coverage: none
|
|
tools: composer:v2
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache Composer dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: composer-
|
|
|
|
- name: Install PHP dependencies
|
|
run: composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
- name: Install Symfony CLI
|
|
run: curl -sS https://get.symfony.com/cli/installer | bash && sudo mv ~/.symfony*/bin/symfony /usr/local/bin/symfony
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- name: Install Node dependencies
|
|
run: npm ci
|
|
|
|
- name: Resolve Playwright version
|
|
id: playwright-version
|
|
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache Playwright browsers
|
|
id: playwright-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/ms-playwright
|
|
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
|
|
|
|
- name: Install Playwright browsers
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
# Browsers came from cache; the apt libs they link against did not.
|
|
- name: Install Playwright system dependencies
|
|
if: steps.playwright-cache.outputs.cache-hit == 'true'
|
|
run: npx playwright install-deps chromium
|
|
|
|
- name: Build frontend assets
|
|
run: |
|
|
php bin/console importmap:install
|
|
php bin/console tailwind:build
|
|
|
|
- name: Prepare database
|
|
run: |
|
|
php bin/console doctrine:database:create --if-not-exists --no-interaction
|
|
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
|
|
|
|
- name: Seed E2E user
|
|
run: php bin/console app:test:seed-user
|
|
|
|
# Fast and dependency-free, so it runs before the browser suite:
|
|
# a failure here is far quicker to read than a Playwright trace.
|
|
- name: Run PHPUnit tests
|
|
run: composer test
|
|
|
|
- name: Run Playwright tests
|
|
run: npx playwright test
|
|
|
|
- name: Upload Playwright report
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report/
|
|
retention-days: 14
|