name: E2E API Smoke on: push: branches: ["main", "master", "development"] paths: - "backend/**" - ".github/workflows/e2e-api-smoke.yml" pull_request: paths: - "backend/**" - ".github/workflows/e2e-api-smoke.yml" workflow_dispatch: jobs: e2e-smoke: name: Core API E2E Smoke runs-on: ubuntu-latest services: postgres: image: postgres:16 env: POSTGRES_DB: nexapg POSTGRES_USER: nexapg POSTGRES_PASSWORD: nexapg ports: - 5432:5432 options: >- --health-cmd "pg_isready -U nexapg -d nexapg" --health-interval 5s --health-timeout 5s --health-retries 20 env: APP_NAME: NexaPG Monitor ENVIRONMENT: test LOG_LEVEL: INFO DB_HOST: 127.0.0.1 DB_PORT: 5432 DB_NAME: nexapg DB_USER: nexapg DB_PASSWORD: nexapg JWT_SECRET_KEY: smoke_jwt_secret_for_ci_only JWT_ALGORITHM: HS256 JWT_ACCESS_TOKEN_MINUTES: 15 JWT_REFRESH_TOKEN_MINUTES: 10080 ENCRYPTION_KEY: 5fLf8HSTbEUeo1c4DnWnvkXxU6v8XJ8iW58wNw5vJ8s= CORS_ORIGINS: http://localhost:5173 POLL_INTERVAL_SECONDS: 30 INIT_ADMIN_EMAIL: admin@example.com INIT_ADMIN_PASSWORD: ChangeMe123! steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.13" - name: Install backend dependencies + test tooling run: | python -m pip install --upgrade pip pip install -r backend/requirements.txt pip install pytest - name: Wait for PostgreSQL service run: | python - <<'PY' import asyncio import asyncpg async def wait_for_db(): dsn = "postgresql://nexapg:nexapg@127.0.0.1:5432/nexapg?sslmode=disable" last_err = None for attempt in range(1, 61): try: conn = await asyncpg.connect(dsn=dsn, timeout=3) try: await conn.execute("SELECT 1") finally: await conn.close() print(f"PostgreSQL ready after {attempt} attempt(s).") return except Exception as exc: last_err = exc await asyncio.sleep(2) raise RuntimeError(f"PostgreSQL not ready after retries: {last_err}") asyncio.run(wait_for_db()) PY - name: Run Alembic migrations working-directory: backend run: alembic upgrade head - name: Run core API smoke suite env: PYTHONPATH: backend run: pytest -q backend/tests/e2e/test_api_smoke.py