Skip to content

Bump actions/upload-artifact from 6 to 7 (#643) #1422

Bump actions/upload-artifact from 6 to 7 (#643)

Bump actions/upload-artifact from 6 to 7 (#643) #1422

# This workflow will install Python dependencies, run tests and report code coverage 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: Unit test and code coverage
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
sudo apt-get update
uv pip install --system -e .[dev]
if [ -f requirements.txt ]; then uv pip install --system -r requirements.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest
- name: Install FULL dependencies
run: |
uv pip install --system -e .[full]
- name: Run FULL unit tests with pytest
run: |
python -m pytest --cov=hats --cov-report=xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-lowest-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade uv
uv venv venv
source venv/bin/activate
if [ -f requirements.txt ]; then
uv pip compile --resolution=lowest-direct pyproject.toml requirements.txt -o requirements_lowest.txt
else
uv pip compile --resolution=lowest-direct pyproject.toml -o requirements_lowest.txt
fi
uv pip install --constraint=requirements_lowest.txt -e .[dev]
- name: List dependencies
run: |
pip list
- name: Run unit tests with pytest
run: |
source venv/bin/activate
python -m pytest