add nox and test against different Python and Django versions (#91)

This commit is contained in:
Josh Thomas 2025-04-21 09:42:50 -05:00 committed by GitHub
parent 074c10bb94
commit d38ee4361d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 206 additions and 17 deletions

View file

@ -6,6 +6,10 @@ on:
branches: [main]
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
@ -13,7 +17,6 @@ env:
CARGO_TERM_COLOR: always
FORCE_COLOR: "1"
PYTHONUNBUFFERED: "1"
UV_VERSION: "0.4.x"
jobs:
pre-commit:
@ -25,7 +28,7 @@ jobs:
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
version: ${{ env.UV_VERSION }}
pyproject-file: pyproject.toml
- uses: actions/cache@v4
with:

View file

@ -12,8 +12,14 @@ on:
tags:
- "*"
pull_request:
branches:
- "release/*"
workflow_dispatch:
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read

View file

@ -5,9 +5,14 @@ on:
push:
branches: [main]
workflow_call:
inputs:
os:
description: "Comma-delineated list of OS targets to run tests on"
required: false
type: string
concurrency:
group: test-${{ github.head_ref }}
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
env:
@ -16,15 +21,10 @@ env:
PYTHONUNBUFFERED: "1"
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
@ -34,10 +34,26 @@ jobs:
enable-cache: true
pyproject-file: pyproject.toml
- name: Install dependencies and build
- id: set-matrix
run: |
uv sync --frozen
uv run maturin build
uv run noxfile.py --session gha_matrix -- "${{ inputs.os }}"
test:
name: Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: generate-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
pyproject-file: pyproject.toml
- name: Run tests
run: cargo test --verbose
run: |
uv run noxfile.py --session "tests(python='${{ matrix.python-version }}', django='${{ matrix.django-version }}')"