Smart code lab testing #62
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 Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| backend: | |
| runs-on: ubuntu-latest | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| JWT_SECRET: ${{secrets.JWT_SECRET}} | |
| ALLOWED_ORIGINS: "http://localhost:5173" | |
| NODE_ENV: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install backend deps | |
| run: cd backend && npm ci | |
| - name: Generate Prisma Client | |
| run: cd backend && npx prisma generate | |
| - name: Run backend tests with coverage | |
| run: cd backend && npm test -- --coverage --ci | |
| - name: Build Backend | |
| run: cd backend && npm run build | |
| frontend: | |
| runs-on: ubuntu-latest | |
| needs: backend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend deps | |
| run: cd frontend && npm ci | |
| - name: Run frontend tests | |
| run: cd frontend && npm run test:coverage | |
| env: | |
| VITE_BACKEND_URL: "http://localhost:8000" | |
| - name: Build frontend | |
| run: cd frontend && npm run build | |
| env: | |
| VITE_BACKEND_URL: "http://localhost:8000" |