name: BankBot AI — CI on: push: branches: [main, develop] pull_request: branches: [main] jobs: # ─── Backend ──────────────────────────────────────────────────────────────── backend: name: Backend — Lint & Import Check runs-on: ubuntu-latest defaults: run: working-directory: backend steps: - uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install dependencies run: pip install -r requirements.txt - name: Verify all routers import cleanly env: USE_SQLITE: "true" run: | python -c " from app.main import app routes = [r.path for r in app.routes if hasattr(r,'path')] print(f'Routes registered: {len(routes)}') assert len(routes) >= 30, f'Expected 30+ routes, got {len(routes)}' print('All routers import OK') " - name: Verify demo seed script imports env: USE_SQLITE: "true" run: python -c "import app.scripts.seed_demo; print('Seed script OK')" # ─── Frontend ─────────────────────────────────────────────────────────────── frontend: name: Frontend — Build & Type Check runs-on: ubuntu-latest defaults: run: working-directory: frontend steps: - uses: actions/checkout@v4 - name: Set up Node.js 20 uses: actions/setup-node@v4 with: node-version: "20" cache: npm cache-dependency-path: frontend/package-lock.json - name: Install dependencies run: npm ci --legacy-peer-deps - name: Type check run: npx tsc --noEmit - name: Lint run: npm run lint - name: Production build env: NEXT_PUBLIC_API_URL: http://localhost:8000 run: npm run build - name: Verify build output run: | test -d .next/standalone && echo "Standalone build OK" || echo "No standalone (OK for non-Docker)" test -d .next/static && echo "Static assets OK" # ─── Docker ───────────────────────────────────────────────────────────────── docker: name: Docker — Build Check runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - name: Build backend image run: docker build -t bankbot-backend:ci ./backend - name: Build frontend image run: | docker build \ --build-arg NEXT_PUBLIC_API_URL=http://localhost:8000 \ -t bankbot-frontend:ci \ ./frontend - name: Smoke test backend container run: | docker run -d --name backend-test \ -e USE_SQLITE=true \ -e JWT_SECRET_KEY=ci-test-secret \ -p 8000:8000 \ bankbot-backend:ci sleep 10 curl -f http://localhost:8000/health || exit 1 curl -f http://localhost:8000/api/status || exit 1 echo "Backend smoke test passed" docker stop backend-test