feat: init e2e workflow setup #4
Workflow file for this run
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: 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 |