Merge pull request #46 from adity1raut/aditya-side #78
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 | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| jobs: | |
| backend: | |
| name: Backend — Node.js ${{ matrix.node-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: ["20.x", "22.x"] | |
| defaults: | |
| run: | |
| working-directory: server | |
| env: | |
| MONGOMS_HOME: /home/runner/.cache/mongodb-binaries | |
| NODE_ENV: test | |
| ANTHROPIC_API_KEY: sk-test-ci-dummy-key | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| cache-dependency-path: server/package-lock.json | |
| - name: Cache MongoDB binary | |
| uses: actions/cache@v4 | |
| with: | |
| path: /home/runner/.cache/mongodb-binaries | |
| key: mongodb-${{ runner.os }}-${{ hashFiles('server/package-lock.json') }} | |
| restore-keys: | | |
| mongodb-${{ runner.os }}- | |
| - run: npm ci | |
| - run: npm test | |
| - name: Upload coverage | |
| if: matrix.node-version == '20.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-coverage | |
| path: server/coverage/ | |
| retention-days: 14 | |
| frontend-lint: | |
| name: Frontend — Lint & Format | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| cache: npm | |
| cache-dependency-path: client/package-lock.json | |
| - run: npm ci | |
| - run: npm run lint | |
| - run: npm run format:check | |
| frontend-build: | |
| name: Frontend — Build (Node.js ${{ matrix.node-version }}) | |
| runs-on: ubuntu-latest | |
| needs: frontend-lint | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: ["20.x", "22.x"] | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| cache-dependency-path: client/package-lock.json | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Upload dist | |
| if: matrix.node-version == '20.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: client/dist/ | |
| retention-days: 7 | |
| # Required status check — add this job to branch protection rules | |
| all-checks-pass: | |
| name: All checks passed | |
| runs-on: ubuntu-latest | |
| needs: [backend, frontend-lint, frontend-build] | |
| if: always() | |
| steps: | |
| - name: Check all jobs | |
| run: | | |
| results="${{ join(needs.*.result, ' ') }}" | |
| for result in $results; do | |
| [ "$result" = "success" ] || exit 1 | |
| done |