Fix tests #9
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: Playwright Tests | |
on: | |
push: | |
pull_request: | |
branches: [main] | |
workflow_call: | |
jobs: | |
test-playwright: | |
concurrency: | |
group: ${{ github.head_ref || github.ref }} | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:alpine | |
env: | |
POSTGRES_USER: blumy | |
POSTGRES_PASSWORD: blumy | |
POSTGRES_DB: blumy_test | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd="pg_isready -U blumy" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
Blumy-Server/node_modules | |
key: modules-${{ hashFiles('Blumy-Server/package-lock.json') }} | |
- name: Cache Playwright Binaries | |
id: cache-playwright | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: playwright-${{ hashFiles('Blumy-Server/package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
working-directory: Blumy-Server | |
run: npm ci | |
- name: Install Playwright Browsers | |
if: steps.cache-playwright.outputs.cache-hit != 'true' | |
working-directory: Blumy-Server | |
run: npx playwright install --with-deps | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
until pg_isready -h localhost -U blumy; do | |
echo "Waiting for PostgreSQL..." | |
sleep 2 | |
done | |
- name: Run Playwright tests | |
env: | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
POSTGRES_USER: blumy | |
POSTGRES_PASSWORD: blumy | |
POSTGRES_DB: blumy_test | |
GOOGLE_CLIENT_ID: DOES_NOT_MATTER | |
GOOGLE_CLIENT_SECRET: DOES_NOT_MATTER | |
PUBLIC_BASE_URL: http://localhost:4173 | |
PUBLIC_MODE: test | |
working-directory: Blumy-Server | |
run: npm run test:integration | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: Blumy-Server/test-results | |
retention-days: 30 | |
- name: Run CTRF annotations | |
run: npx github-actions-ctrf Blumy-Server/test-results/ctrf-report.json | |
if: always() |