name: CI

on:
  push:
    branches: [main]
  pull_request:
    types: [opened, synchronize]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
          cache: "npm"
      - run: npm ci
        working-directory: client
      - run: npm ci
        working-directory: server
      - name: npm install, build, and test
        run: |
          npm ci
          npm run build
          npm run build:types
          npm run test
