name: CI

on:
  push:
    branches: [master, main]
  pull_request:
    branches: [master, main]

jobs:
  app:
    name: proof-of-work (Next.js app)
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: proof-of-work
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
          cache-dependency-path: proof-of-work/package-lock.json
      - run: npm ci
      - name: Prisma validate
        run: npx prisma validate
      - name: Prisma generate
        run: npx prisma generate
      - name: Type-check
        run: npx tsc --noEmit
      - name: Tests
        run: npm test

  startos:
    name: start9/0.4 (StartOS package code)
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: start9/0.4
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
          cache-dependency-path: start9/0.4/package-lock.json
      - run: npm ci
      - name: Type-check StartOS package source
        run: npm run check
