name: Test

on:
  push:
    branches: [main]
    paths-ignore:
      - 'sdk/**'
      - 'web/docs/**'
      - '.github/workflows/test-sdk-*.yaml'
  pull_request:
    branches: [main]
    paths-ignore:
      - 'sdk/**'
      - 'web/docs/**'
      - '.github/workflows/test-sdk-*.yaml'

permissions:
  contents: read

jobs:
  test:
    name: Server + Frontend
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: "1.26"
          cache: true

      - name: Set up pnpm
        uses: pnpm/action-setup@v4
        with:
          version: 9

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "22"
          cache: "pnpm"
          cache-dependency-path: "web/marmot/pnpm-lock.yaml"

      - name: Install dev dependencies
        run: make dev-deps

      - name: Generate swagger
        run: make swagger

      - name: Lint frontend
        run: make frontend-lint

      - name: Lint server (Go)
        run: make server-lint

      - name: Run actionlint
        run: make actionlint

      - name: Run Go tests
        run: make test
