Skip to content

[pre-commit.ci] pre-commit autoupdate #279

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #279

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
UV_SYSTEM_PYTHON: 1
UV_LINK_MODE: copy
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
django-version: ["4.2", "5.0", "5.1", "5.2"]
steps:
- uses: actions/checkout@v4
# https://szeyusim.medium.com/optimizing-uv-in-github-actions-one-global-cache-to-rule-them-all-9c64b42aee7f
- name: Restore global uv cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-python${{ matrix.python-version }}-django${{ matrix.django-version }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-main-python${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
# Install the latest version of uv
# version:
python-version: "${{ matrix.python-version }}"
enable-cache: false
- run: |
uv sync --all-extras --dev --python python${{ matrix.python-version }} --locked --inexact
uv add "Django~=${{ matrix.django-version }}"
- name: Run tests
run: |
uv run pytest --cov
- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: ${{ steps.cache-restore.outputs.cache-primary-key }}