FE <-> BE: Search integration #258
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - '**' | |
| jobs: | |
| backend: | |
| name: Backend Tests #& Linting | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create backend .env file | |
| run: | | |
| cat > backend/.env << EOF | |
| NODE_ENV=test | |
| PORT=3001 | |
| DATABASE_URL=postgresql://devuser:devpassword@postgres:5432/devdb | |
| DIRECT_URL=postgresql://devuser:devpassword@postgres:5432/devdb | |
| SYNC_FROM_PRODUCTION=false | |
| TMDB_API_TOKEN=dummy-token-for-ci-tests | |
| SUPABASE_JWT_SECRET=dummy-jwt-secret-for-ci-tests | |
| SUPABASE_URL=https://dummy.supabase.co | |
| EOF | |
| - name: Start services | |
| run: docker compose -f docker-compose.ci.yml up -d | |
| - name: Wait for services to be healthy | |
| run: | | |
| echo "Waiting for PostgreSQL to be ready..." | |
| timeout 60 bash -c 'until docker compose -f docker-compose.ci.yml exec -T postgres pg_isready -U devuser -d devdb; do sleep 2; done' | |
| echo "PostgreSQL is ready!" | |
| echo "Waiting for backend to be ready..." | |
| sleep 10 | |
| - name: Check service logs | |
| if: failure() | |
| run: docker compose -f docker-compose.ci.yml logs | |
| # Commented out to avoid merge conflicts for now | |
| # - name: Run backend linting | |
| # run: docker compose -f docker-compose.ci.yml exec -T backend npm run lint | |
| - name: Run backend tests | |
| run: docker compose -f docker-compose.ci.yml exec -T backend npm run test | |
| - name: Generate frontend types | |
| run: docker compose -f docker-compose.ci.yml exec -T backend npm run types:all | |
| - name: Copy generated types from container | |
| run: | | |
| mkdir -p frontend-types-artifact | |
| docker compose -f docker-compose.ci.yml cp backend:/app/src/docs/api-types.ts frontend-types-artifact/api-generated.ts | |
| - name: Upload generated types | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-types | |
| path: frontend-types-artifact/api-generated.ts | |
| retention-days: 1 | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose -f docker-compose.ci.yml down -v | |
| frontend: | |
| name: Frontend Tests #& Linting | |
| runs-on: ubuntu-latest | |
| needs: backend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Download generated types | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: frontend-types | |
| path: frontend/types/ | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm install | |
| - name: Run TypeScript type checking | |
| run: | | |
| cd frontend | |
| npx tsc --noEmit | |
| # Commented out to avoid merge conflicts for now | |
| # - name: Run frontend linting | |
| # run: | | |
| # cd frontend | |
| # npm run lint | |
| - name: Run frontend tests | |
| run: | | |
| cd frontend | |
| npm run test -- --run |