name: Test

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

jobs:
  python-smoke:
    runs-on: ubuntu-latest
    steps:
      # actions/checkout@v6
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

      - name: Set up Python
        # actions/setup-python@v6
        uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
        with:
          python-version: "3.11"

      - name: Install dependencies
        run: pip install anthropic python-dotenv pytest

      - name: Run Python smoke tests
        run: python -m pytest tests -q

  web-build:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: web
    steps:
      # actions/checkout@v6
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

      - name: Set up Node.js
        # actions/setup-node@v6
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
        with:
          node-version: "20"
          cache: "npm"
          cache-dependency-path: web/package-lock.json

      - name: Install dependencies
        run: npm ci

      - name: Build
        run: npm run build
