Skip to content

Commit 1d42374

Browse files
Add GitHub Actions workflow for E2E tests with local Supabase setup
1 parent 24293c9 commit 1d42374

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: E2E Tests with Local Supabase
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
e2e-tests:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:15
16+
env:
17+
POSTGRES_PASSWORD: postgres
18+
POSTGRES_DB: postgres
19+
options: >-
20+
--health-cmd pg_isready
21+
--health-interval 10s
22+
--health-timeout 5s
23+
--health-retries 5
24+
ports:
25+
- 5432:5432
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '18'
35+
cache: 'npm'
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Install Supabase CLI
41+
run: |
42+
curl -fsSL https://github.com/supabase/cli/releases/download/v1.123.4/supabase_linux_amd64.tar.gz | tar -xz
43+
sudo mv supabase /usr/local/bin/
44+
45+
- name: Start Supabase local instance
46+
run: |
47+
supabase start
48+
sleep 10
49+
50+
- name: Install Playwright browsers
51+
run: npx playwright install --with-deps
52+
53+
- name: Start Angular app
54+
run: |
55+
npm run start:local &
56+
sleep 30
57+
# Wait for app to be ready
58+
timeout 60 bash -c 'until curl -f http://localhost:4200; do sleep 2; done'
59+
60+
- name: Run E2E tests
61+
run: npm run e2e:local
62+
63+
- name: Upload test results
64+
uses: actions/upload-artifact@v4
65+
if: always()
66+
with:
67+
name: playwright-report
68+
path: playwright-report/
69+
retention-days: 30
70+
71+
- name: Stop services
72+
if: always()
73+
run: |
74+
# Kill Angular dev server
75+
pkill -f "ng serve" || true
76+
# Stop Supabase
77+
supabase stop || true

0 commit comments

Comments
 (0)