name: Test

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

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.9", "3.10", "3.11", "3.12"]

    steps:
      - uses: actions/checkout@v4

      - name: Set up uv
        uses: astral-sh/setup-uv@v4
        with:
          version: "latest"

      - name: Set up Python ${{ matrix.python-version }}
        run: uv python install ${{ matrix.python-version }}

      - name: Install dependencies
        run: uv sync --dev

      - name: Run tests
        run: uv run pytest tests/ -v --tb=short

      - name: Check imports work
        run: |
          uv run python -c "from naijaml.nlp import detect_language; print(detect_language('Bawo ni'))"
          uv run python -c "from naijaml.nlp import diacritize_dot_below; print(diacritize_dot_below('Ojo dara'))"
          uv run python -c "from naijaml.nlp import analyze_sentiment; print(analyze_sentiment('This too sweet'))"
