Skip to content

Merge pull request #46 from adity1raut/aditya-side #54

Merge pull request #46 from adity1raut/aditya-side

Merge pull request #46 from adity1raut/aditya-side #54

Workflow file for this run

name: Backend CI
on:
push:
paths:
- "server/**"
- ".github/workflows/ci-backend.yml"
pull_request:
paths:
- "server/**"
- ".github/workflows/ci-backend.yml"
defaults:
run:
working-directory: server
jobs:
test:
name: Test — Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["20.x", "22.x"]
env:
MONGOMS_HOME: /home/runner/.cache/mongodb-binaries
NODE_ENV: test
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
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: npm
cache-dependency-path: server/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm run format:check