# 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: Python Test

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

jobs:
  build:
  
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.10', '3.11', '3.12']
        platform: [ ubuntu-latest, macos-latest, windows-latest ]
    runs-on: ${{ matrix.platform }}
    
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python-version }}
    - uses: astral-sh/setup-uv@v4
      with:
        version: "latest"
    - name: Install dependencies
      run: |
        uv sync
    - name: Lint with ruff
      run: |
        uv run ruff check -e
    - name: Test with pytest
      run: |
        cd tests
        uv run pytest --cov-config .coveragerc --cov=uhugo -vv --cov-report=xml
    - name: "Upload coverage to Codecov"
      run: |
        cd tests
        uv run codecov --token=${{ secrets.CODECOV_TOKEN }}
