name: CI

on:
  push:
    branches: ["**"]
  pull_request:

jobs:
  test:
    runs-on: self-hosted
    strategy:
      fail-fast: false
      matrix:
        project: [rollerlogic-api, rollerlogic-mobile]
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: "npm"
          cache-dependency-path: |
            rollerlogic-api/package-lock.json
            rollerlogic-mobile/package-lock.json

      - name: Install
        working-directory: ${{ matrix.project }}
        run: npm ci

      - name: Typecheck / Build
        working-directory: ${{ matrix.project }}
        run: npm run build

      - name: Tests
        working-directory: ${{ matrix.project }}
        run: npm test
