-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (58 loc) · 1.74 KB
/
e2e-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: E2E Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.42.0-jammy
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Create dummy env file
run: cp .env.example .env
- name: Install Dependencies
run: npm ci
- name: Seed Database
run: |
npx prisma db push
npx prisma db seed
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Start dev server
run: npm run dev > /dev/null 2>&1 &
- name: Wait for dev server to be ready
run: timeout 60s sh -c 'until curl http://localhost:3000 -I; do echo "Waiting for dev server to be running..."; sleep 2; done'
- name: Run Playwright tests
run: npx playwright test
env:
HOME: /root
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
env:
DATABASE_URL: "postgres://postgres:secret@postgres:5432/postgres"
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}