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

name: Python application
on:
  push:
    branches:
    - main
  pull_request:
    branches:
    - main
jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        # The versions pyproject's requires-python actually allows.
        python-ver:
        - '3.10'
        - '3.11'
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v4

    - name: Install uv
      uses: astral-sh/setup-uv@v5
      with:
        enable-cache: true
        python-version: "${{matrix.python-ver}}"

    - name: Install apt deps
      run: sudo apt-get update && sudo apt-get install -qq -y libxml2-dev libxslt1-dev

    - name: Install dependencies
      run: uv sync --all-groups

    - name: Test with pytest
      run: uv run pytest
      env:
        PYTHONDEVMODE: 1
        PYTHONPATH: .

    - uses: codecov/codecov-action@v4
      with:
        name: build-${{ matrix.python-ver }}
        fail_ci_if_error: true
        token: ${{ secrets.CODECOV_TOKEN }}
