Skip to content

fix: add type declarations for some missing settings (#2870) #5479

fix: add type declarations for some missing settings (#2870)

fix: add type declarations for some missing settings (#2870) #5479

Workflow file for this run

name: test
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
UV_FROZEN: true # https://docs.astral.sh/uv/configuration/environment/#uv_frozen
UV_NO_SYNC: true # prevent `uv run` cmd from bringing very dev dependencies
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
mypy-self-check:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
fail-fast: false
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Run mypy on plugin code
run: uv run mypy --strict mypy_django_plugin
- name: Run mypy on ext code
run: uv run mypy --strict ext
- name: Run mypy on scripts and utils
run: uv run mypy --strict scripts
- name: Run mypy on stubs
run: uv run mypy --cache-dir=/dev/null --no-incremental django-stubs
- name: Run mypy on the test cases
run: uv run mypy --strict tests
test:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
shard: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v5
- name: Setup system dependencies
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
# Must match `shard` definition in the test matrix:
- name: Run pytest tests
run: uv run pytest --num-shards=4 --shard-id=${{ matrix.shard }} -n auto tests
test-older-django:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
shard: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v5
- name: Setup system dependencies
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Downgrade Django
run: uv pip install django==5.0.0
# Exit 1 only if ont of the pytest error is a mypy crash
- name: Run pytest tests
run: "! uv run pytest --num-shards=4 --shard-id=${{ matrix.shard }} -n auto tests | grep 'pytest_mypy_plugins.utils.TypecheckAssertionError: Critical error occurred'"
stubtest:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']
fail-fast: false
steps:
- uses: actions/checkout@v5
- name: Setup system dependencies
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Run stubtest
run: uv run ./scripts/stubtest.sh
run-pyright:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12'] # TODO: enable on other versions
fail-fast: false
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group pyright
# See https://github.com/jakebailey/pyright-action#providing-a-pyright-version-sourced-from-preexisting-dependencies
- name: Add venv to path
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Run pyright on the stubs
uses: jakebailey/pyright-action@v2
with:
version: PATH
annotate: false
continue-on-error: true # TODO: remove this part
- name: Run pyright on the test cases
uses: jakebailey/pyright-action@v2
with:
version: PATH
project: ./pyrightconfig.testcases.json
matrix-test:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
django-version: ['5.0', '5.1', '5.2']
steps:
- uses: actions/checkout@v5
- name: Setup system dependencies
run: |
sudo apt-get update
sudo apt-get install binutils libproj-dev gdal-bin
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --no-dev --group tests
- name: Run django-stubs-ext tests
run: uv run --with "django==${{ matrix.django-version }}" pytest ext
build-and-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-tags: true
- name: Install uv & Python
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
- name: Ensure uv.lock is up to date
run: env --unset=UV_FROZEN uv lock --check
- name: Build
run: uv build --all-packages