Skip to content

Switch to uv for building and packaging #334

Switch to uv for building and packaging

Switch to uv for building and packaging #334

Workflow file for this run

name: test suite
on:
push:
branches:
- master
pull_request:
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
django-version:
- "4.2"
- "5.0"
- "5.1"
exclude:
- django-version: 4.2
python-version: 3.12
- django-version: 4.2
python-version: 3.13
- django-version: 5.0
python-version: 3.9
- django-version: 5.1
python-version: 3.9
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
cache-suffix: ${{ matrix.python-version }}
- name: Install Python
run: uv python install ${{ matrix.python-version }}
env:
UV_PYTHON_PREFERENCE: only-managed
- run: uv sync --all-groups
- run: uv run --with 'django~=${{ matrix.django-version }}.0' pytest --cov --cov-report=
env:
DJANGO_SETTINGS_MODULE: tests.settings
PYTHONPATH: "."
- name: Rename coverage file
run: mv .coverage .coverage.py${{ matrix.python-version }}.dj${{ matrix.django-version }}
- name: Save coverage file
uses: actions/upload-artifact@v4
with:
name: .coverage.py${{ matrix.python-version }}.dj${{ matrix.django-version }}
path: .coverage.py${{ matrix.python-version }}.dj${{ matrix.django-version }}
include-hidden-files: true
codecov:
needs: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv python install 3.13
- uses: actions/download-artifact@v4
with:
pattern: .coverage.*
merge-multiple: true
- name: Combine coverage
run: |
uv run coverage combine
uv run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv python install 3.13
- run: uv sync --group dev
- run: uvx ruff check
- run: uvx ruff format --check
check:
runs-on: ubuntu-latest
if: always()
needs:
- pytest
- lint
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}