mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-12-23 08:47:53 +00:00
123 lines
2.9 KiB
YAML
123 lines
2.9 KiB
YAML
name: test
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- .github/workflows/test.yml
|
|
- crates/**
|
|
- tests/**
|
|
- Cargo.lock
|
|
- Cargo.toml
|
|
- pyproject.toml
|
|
- noxfile.py
|
|
- uv.lock
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- .github/workflows/test.yml
|
|
- crates/**
|
|
- tests/**
|
|
- Cargo.lock
|
|
- Cargo.toml
|
|
- pyproject.toml
|
|
- noxfile.py
|
|
- uv.lock
|
|
workflow_call:
|
|
inputs:
|
|
os:
|
|
description: Comma-delineated list of OS targets to run tests on
|
|
required: false
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
os:
|
|
description: Comma-delineated list of OS targets to run tests on
|
|
required: false
|
|
type: string
|
|
|
|
concurrency:
|
|
group: test-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
FORCE_COLOR: "1"
|
|
PYTHONUNBUFFERED: "1"
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
generate-matrix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e
|
|
with:
|
|
activate-environment: true
|
|
enable-cache: true
|
|
|
|
- name: Determine OS targets
|
|
env:
|
|
HEAD_REF: ${{ github.head_ref }}
|
|
run: |
|
|
if [[ "$HEAD_REF" == release/* ]]; then
|
|
echo "OS=macos-latest,ubuntu-latest,windows-latest" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- id: set-matrix
|
|
env:
|
|
OS: ${{ inputs.os }}
|
|
run: |
|
|
uv run --no-project --with "nox[uv]" nox --session gha_matrix -- "${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) }}
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e
|
|
with:
|
|
activate-environment: true
|
|
enable-cache: true
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Run tests
|
|
shell: bash
|
|
env:
|
|
DJANGO_VERSION: ${{ matrix.django-version }}
|
|
PYTHON_VERSION: ${{ matrix.python-version }}
|
|
run: |
|
|
uv run --no-project --with "nox[uv]" nox --session "tests(python='${PYTHON_VERSION}', django='${DJANGO_VERSION}')"
|
|
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
if: always()
|
|
steps:
|
|
- name: OK
|
|
if: ${{ !(contains(needs.*.result, 'failure')) }}
|
|
run: exit 0
|
|
- name: Fail
|
|
if: ${{ contains(needs.*.result, 'failure') }}
|
|
run: exit 1
|