# Continuous integration — SPEC §12 # Node 20. Steps: lint → typecheck → test + coverage → build → docker build. # Runs on every PR and on pushes to main. name: CI on: push: branches: ["main"] pull_request: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true jobs: lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - run: npm ci - run: npm run lint typecheck: name: Typecheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - run: npm ci - run: npm run typecheck test: name: Test (coverage) runs-on: ubuntu-latest services: mongo: image: mongo:7 ports: - "27017:27017" env: # Backend integration tests run against the GitHub-hosted Mongo service # (SPEC §11); falls back to mongodb-memory-server when unset. MONGODB_URI: mongodb://127.0.0.1:27017/workorders steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - run: npm ci - run: npm run test:coverage build: name: Build runs-on: ubuntu-latest needs: [lint, typecheck, test] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - run: npm ci - run: npm run build docker: name: Docker build runs-on: ubuntu-latest needs: [build] steps: - uses: actions/checkout@v4 - name: Build backend image run: docker build -f backend/Dockerfile --target prod -t workorders-api:ci . - name: Build frontend/nginx image run: docker build -f frontend/Dockerfile --target prod -t workorders-nginx:ci .