Merge pull request #3 from rudraprasaaad/fix/game-timer-issue #54
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: Continuous Integration - Backend & Frontend | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - "backend/**" | |
| - "frontend/**" | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - "backend/**" | |
| - "frontend/**" | |
| jobs: | |
| build-and-test: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| outputs: | |
| backend_changed: ${{ steps.backend-changes.outputs.any_changed }} | |
| frontend_changed: ${{ steps.frontend-changes.outputs.any_changed }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Detect backend changes | |
| id: backend-changes | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: backend/** | |
| - name: Detect frontend changes | |
| id: frontend-changes | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: frontend/** | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.14.0 | |
| - name: Install dependencies (from workspace root) | |
| run: pnpm install | |
| - name: Generate Prisma Client | |
| if: steps.backend-changes.outputs.any_changed == 'true' | |
| run: pnpm --filter backend exec prisma generate | |
| - name: Lint and Build Backend | |
| if: steps.backend-changes.outputs.any_changed == 'true' | |
| run: | | |
| pnpm --filter backend lint | |
| pnpm --filter backend build | |
| - name: Lint and Build Frontend | |
| if: steps.frontend-changes.outputs.any_changed == 'true' | |
| run: | | |
| pnpm --filter frontend lint | |
| pnpm --filter frontend build | |
| build-and-push-docker: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| if: needs.build-and-test.outputs.backend_changed == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker image | |
| run: | | |
| docker build -t ${{ secrets.DOCKER_USERNAME}}/chess-app-backend:latest -f backend/Dockerfile . | |
| docker push ${{ secrets.DOCKER_USERNAME }}/chess-app-backend:latest |