fix: suppress duplicate pending detection SSE broadcasts (#2433) #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, 3, 4] | |
| shardTotal: [4] | |
| 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: 5 | |
| 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 |