-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (108 loc) · 3.28 KB
/
Copy pathe2e-tests.yml
File metadata and controls
114 lines (108 loc) · 3.28 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: E2E Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:8
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install backend dependencies
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install frontend dependencies
working-directory: web
run: npm ci
- name: Install E2E test dependencies
working-directory: tests
run: npm ci
- name: Install Playwright browsers
working-directory: tests
run: npx playwright install --with-deps chromium
continue-on-error: true
- name: Run database migrations
working-directory: backend
run: |
alembic upgrade head
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
- name: Start backend
working-directory: backend
run: |
uvicorn main:app --host 0.0.0.0 --port 8000 &
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
REDIS_URL: redis://localhost:6379
ISSUER_URI: http://localhost:8080/realms/tasks
PUBLIC_ISSUER_URI: http://localhost:8080/realms/tasks
CLIENT_ID: tasks-backend
CLIENT_SECRET: tasks-secret
ENV: test
- name: Build frontend
working-directory: web
run: npm run build
- name: Start frontend
working-directory: web
run: |
npm start &
env:
NEXT_PUBLIC_API_URL: http://localhost:8000/graphql
- name: Wait for backend
run: |
echo "Waiting for backend to start..."
timeout 120 bash -c 'until curl -f -s http://localhost:8000/health > /dev/null 2>&1; do sleep 2; done'
echo "Backend is ready!"
- name: Wait for frontend
run: |
echo "Waiting for frontend to start..."
timeout 120 bash -c 'until curl -f -s http://localhost:3000 > /dev/null 2>&1; do sleep 2; done'
echo "Frontend is ready!"
- name: Run E2E tests
working-directory: tests
run: |
npx playwright test
env:
E2E_BASE_URL: http://localhost:3000
CI: true
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30