Skip to content

fix(build): use go.mod as single source of truth for Go version #676

fix(build): use go.mod as single source of truth for Go version

fix(build): use go.mod as single source of truth for Go version #676

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:
# Disabled: E2E tests consistently time out — backend endpoints unavailable in CI
if: false
name: E2E Tests
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
# --- Go backend setup ---
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
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 (chromium only in CI) ---
- name: Run Playwright E2E tests
working-directory: frontend
run: npx playwright test --project=chromium
timeout-minutes: 7
env:
CI: 'true'
# --- Upload artifacts on failure ---
- name: Upload test results
uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-e2e-results
path: |
frontend/test-results/
frontend/playwright-report/
retention-days: 7
# --- Cleanup ---
- name: Stop backend
if: always()
run: |
if [ -n "$BACKEND_PID" ]; then
kill $BACKEND_PID 2>/dev/null || true
fi