# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests

on:
  push:
    tags:
      - "*"
    branches:
      - main
  pull_request:
  workflow_dispatch:
  schedule:
    - cron: "0 0 1 * *"

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
        os: [ubuntu-latest, macOS-latest, windows-latest]
    steps:
    - name: Checkout
      uses: actions/checkout@v4
      with:
        fetch-depth: 100
        persist-credentials: false
    - name: Fetch git tags
      run: git fetch origin 'refs/tags/*:refs/tags/*'
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}
    - name: Build Wheel and Install
      run: pip install -e .
    - name: Test Report Generation with No Dependencies
      run: python -c "import scooby;scooby.doo();"
    - name: Install testing requirements
      run: pip install -r requirements_test.txt
    - name: Test Entire API
      run: make apitest
    - name: Doctests
      run: make doctest
    - uses: codecov/codecov-action@v4
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        files: coverage.xml
        verbose: true
