name: CI

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

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    env:
      # Provide dummy/default env vars so code paths that read them won't fail.
      OPENAI_API_KEY: dummy
      # Default to local Ollama endpoint for tests (tests mock LLM so it's unused).
      OPENAI_BASE_URL: http://localhost:11434/api/chat
      OPENAI_MODEL: qwen3:latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
          cache: true

      - name: Go Vet
        run: go vet ./...

      - name: Run Tests
        run: go test -count=1 ./...

      - name: Build (sanity)
        run: go build -v ./...

