name: Test

on:
  push:
    branches:
    - main

  pull_request:
    branches:
    - main

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: "3.12"
        cache: pip

    - name: Install dependencies
      run: |
        pip install -r requirements.txt
        pip install -r aws/requirements.txt

    - name: Run linting
      run: |
        ruff check .
        ruff format --check .

    - name: Check README files with Cog
      run: ./text/recog --check

    - name: Run tests
      run: |
        find . -name 'test_*.py' -not -path './.venv/*' | sort | xargs pytest
