name: Flaky Test Report on: schedule: - cron: "0 6 * * 1" # Every Monday 6am workflow_dispatch: env: GIT_SSL_NO_VERIFY: "true" NODE_TLS_REJECT_UNAUTHORIZED: "0" jobs: flaky-report: name: Detect flaky tests runs-on: ubuntu-latest timeout-minutes: 60 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Node uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 with: node-version: "20" cache: "npm" cache-dependency-path: package-lock.json - name: Set up Go uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: go-version: "1.24" cache-dependency-path: veza-backend-api/go.sum - name: Install dependencies run: npm ci - name: Add veza.fr to hosts run: echo "127.0.0.1 veza.fr" | sudo tee -a /etc/hosts - name: Start backend services run: | docker compose up -d postgres redis rabbitmq for i in $(seq 1 30); do if docker exec veza_postgres pg_isready -U veza 2>/dev/null; then break; fi sleep 2 done - name: Run database migrations env: DATABASE_URL: postgresql://veza:devpassword@localhost:15432/veza?sslmode=disable run: cd veza-backend-api && go run cmd/migrate_tool/main.go - name: Start backend API env: APP_ENV: test APP_PORT: "18080" DATABASE_URL: postgresql://veza:devpassword@localhost:15432/veza?sslmode=disable REDIS_URL: redis://localhost:16379 JWT_SECRET: flaky-test-jwt-secret COOKIE_SECURE: "false" CORS_ALLOWED_ORIGINS: http://localhost:5174 DISABLE_RATE_LIMIT_FOR_TESTS: "true" ACCOUNT_LOCKOUT_EXEMPT_EMAILS: "user@veza.music,artist@veza.music,admin@veza.music" run: | cd veza-backend-api && go build -o veza-api ./cmd/api/main.go && ./veza-api & sleep 10 - name: Install Playwright Browsers run: npx playwright install --with-deps chromium - name: Run E2E tests (3x retries to detect flakiness) run: | npx playwright test \ --config=tests/e2e/playwright.config.ts \ --project=chromium \ --retries=3 \ --reporter=json continue-on-error: true env: PORT: "5174" VITE_API_URL: "/api/v1" PLAYWRIGHT_BASE_URL: "http://localhost:5174" - name: Generate flaky report run: node scripts/flaky-detection.mjs > flaky-report.md - name: Upload flaky report uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: name: flaky-test-report path: flaky-report.md retention-days: 30 - name: Create/update issue with flaky tests if: always() run: | REPORT=$(cat flaky-report.md) FLAKY_COUNT=$(grep -c "^|" flaky-report.md | head -1 || echo "0") if [ "$FLAKY_COUNT" -gt 2 ]; then echo "Found flaky tests — check artifact for details" fi