-
-
Notifications
You must be signed in to change notification settings - Fork 100
172 lines (148 loc) · 4.65 KB
/
frontend-e2e-test.yml
File metadata and controls
172 lines (148 loc) · 4.65 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Frontend E2E Tests
on:
push:
branches: [main]
paths:
- 'frontend/**'
- 'internal/api/**'
- '.github/workflows/frontend-e2e-test.yml'
pull_request:
paths:
- 'frontend/**'
- 'internal/api/**'
- '.github/workflows/frontend-e2e-test.yml'
concurrency:
group: e2e-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
e2e-tests:
name: E2E Shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2]
shardTotal: [2]
steps:
- name: Checkout code
uses: actions/checkout@v6
# --- Go backend setup ---
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.26'
cache: true
- name: Setup TensorFlow Lite
uses: ./.github/actions/setup-tensorflow
# --- Node.js setup ---
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- name: Install frontend dependencies
working-directory: frontend
run: npm ci
# --- Install Playwright browsers (chromium only for CI speed) ---
- name: Install Playwright Chromium
working-directory: frontend
run: npx playwright install --with-deps chromium
# --- Build frontend ---
- name: Build frontend
working-directory: frontend
run: npm run build
# --- Build backend (skipfrontend tag: uses stub embed, serves from disk) ---
- name: Build backend
run: |
go build -trimpath -tags skipfrontend \
-ldflags "-s -w" \
-o bin/birdnet-go
# --- Start backend ---
- name: Start backend
run: |
./bin/birdnet-go realtime &
BACKEND_PID=$!
echo "BACKEND_PID=$BACKEND_PID" >> $GITHUB_ENV
echo "Waiting for backend health endpoint..."
for i in $(seq 1 60); do
if curl -sf http://localhost:8080/api/v2/health > /dev/null 2>&1; then
echo "Backend is ready (attempt $i)"
break
fi
if [ $i -eq 60 ]; then
echo "Backend failed to start within 60 seconds"
exit 1
fi
sleep 1
done
# --- Run Playwright E2E tests (sharded, chromium only in CI) ---
- name: Run Playwright E2E tests
working-directory: frontend
run: npx playwright test --project=chromium --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
timeout-minutes: 10
env:
CI: 'true'
# --- Upload artifacts on failure ---
- name: Upload test results
uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-e2e-results-shard-${{ matrix.shardIndex }}
path: |
frontend/test-results/
frontend/playwright-report/
retention-days: 7
# --- Upload blob report for merging ---
- name: Upload blob report
uses: actions/upload-artifact@v7
if: always()
with:
name: blob-report-${{ matrix.shardIndex }}
path: frontend/blob-report/
retention-days: 1
# --- Cleanup ---
- name: Stop backend
if: always()
run: |
if [ -n "$BACKEND_PID" ]; then
kill $BACKEND_PID 2>/dev/null || true
fi
# Merge shard reports into a single HTML report
merge-reports:
name: Merge E2E Reports
if: always()
needs: [e2e-tests]
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- name: Install frontend dependencies
working-directory: frontend
run: npm ci
- name: Download blob reports
uses: actions/download-artifact@v7
with:
path: frontend/all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge reports
working-directory: frontend
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload merged report
uses: actions/upload-artifact@v7
if: failure() || cancelled()
with:
name: playwright-e2e-report
path: frontend/playwright-report/
retention-days: 7