1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
name: Build
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
env:
LATEST_PY_VERSION: '3.14'
COVERAGE_ARGS: '--cov --cov-report=term --cov-report=xml'
XDIST_ARGS: '--numprocesses=auto'
jobs:
# Run unit tests for each supported python version
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.14', '3.13', '3.12', '3.11', '3.10']
steps:
# Install dependencies, with caching
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install dependencies
run: |
uv python install ${{ matrix.python-version }}
uv sync --all-groups
# Run tests with coverage report
- name: Run tests
run: uv run pytest -rs -vv ${{ env.XDIST_ARGS }} ${{ env.COVERAGE_ARGS }}
# Latest python version: send coverage report to codecov
- name: "Upload coverage report to Codecov"
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
uses: codecov/codecov-action@v5
# Run code analysis checks via pre-commit hooks
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.LATEST_PY_VERSION }}
- name: Run style checks & linting
uses: j178/prek-action@564dda4cfa5e96aafdc4a5696c4bf7b46baae5ac
|