-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (124 loc) · 3.98 KB
/
frontend-e2e.yml
File metadata and controls
143 lines (124 loc) · 3.98 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Frontend E2E Tests
on:
push:
branches: [main, develop]
paths:
- 'frontend/**'
- 'backend/**'
- '.github/workflows/frontend-e2e.yml'
pull_request:
branches: [main, develop]
paths:
- 'frontend/**'
- 'backend/**'
- '.github/workflows/frontend-e2e.yml'
# Cancel in-progress runs for the same workflow and branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-tests:
name: Playwright E2E
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
working-directory: ./frontend
run: bun install --frozen-lockfile
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('frontend/bun.lock') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers
working-directory: ./frontend
run: bunx playwright install --with-deps chromium
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install Playwright system dependencies
working-directory: ./frontend
run: bunx playwright install-deps chromium
if: steps.playwright-cache.outputs.cache-hit == 'true'
- name: Install Encore CLI
run: |
curl -L https://encore.dev/install.sh | bash
echo "${HOME}/.encore/bin" >> "${GITHUB_PATH}"
- name: Install backend dependencies
working-directory: ./backend
run: bun install --frozen-lockfile
- name: Start backend service
working-directory: ./backend
run: |
encore run --port=4000 > /tmp/backend.log 2>&1 &
echo $! > /tmp/backend.pid
# Wait for backend to be ready
for i in {1..30}; do
if curl -f http://localhost:4000/health >/dev/null 2>&1; then
echo "✅ Backend is ready"
break
fi
echo "⏳ Waiting for backend (attempt $i/30)..."
sleep 2
done
env:
BACKEND_PORT: 4000
- name: Build frontend
working-directory: ./frontend
run: bun run build
env:
PUBLIC_API_BASE: http://localhost:4000
VITE_BACKEND_BASE_URL: http://localhost:4000
- name: Run E2E tests
working-directory: ./frontend
run: bun run test:e2e:ci
env:
CI: true
HEADLESS: true
VITE_BACKEND_BASE_URL: http://localhost:4000
FRONTEND_URL: http://localhost:5173
- name: Stop backend service
if: always()
run: |
if [ -f /tmp/backend.pid ]; then
kill "$(cat /tmp/backend.pid)" || true
rm /tmp/backend.pid
fi
- name: Upload backend logs
if: always()
uses: actions/upload-artifact@v4
with:
name: backend-logs
path: /tmp/backend.log
retention-days: 7
if-no-files-found: ignore
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 7
if-no-files-found: ignore
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: frontend-test-results
path: frontend/test-results/
retention-days: 7
if-no-files-found: ignore