Skip to content

feat: init e2e workflow setup #4

feat: init e2e workflow setup

feat: init e2e workflow setup #4

Workflow file for this run

name: E2E Tests
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
e2e:
runs-on: ubuntu-latest
env:
DATABASE_URL: "postgresql://postgres:secret@codu-db:5432/postgres"
NEXTAUTH_URL: http://localhost:3000/api/auth
GITHUB_ID: ${{ secrets.E2E_GITHUB_ID }}
GITHUB_SECRET: ${{ secrets.E2E_GITHUB_SECRET }}
services:
codu-db:
image: postgres:15-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Wait for PostgreSQL to be ready
run: docker-compose exec codu-db pg_isready -U postgres
- name: Install dependencies
run: npm install
- name: Seed database
run: |
npm db:push
npm db:seed
- name: Run Playwright tests
run: npx playwright test --reporter=github
- name: Upload Playwright artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: playwright-artifacts
path: |
playwright-report
test-results
traces
- name: Save traces for inspection
if: failure()
run: |
mkdir -p trace-artifacts
cp -R playwright-report traces/* trace-artifacts/
- name: Upload traces
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-traces
path: trace-artifacts