From 58ed5a22762d4477fd2e47ecd461e56eb3c95b08 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Wed, 20 Aug 2025 12:14:00 +0300 Subject: [PATCH 1/2] CI: run typechecks only once, not for each Django/Python version --- .github/workflows/test.yml | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aa23a08..d732aa5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,25 @@ name: test on: [push, pull_request] jobs: + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + + - name: Install dependencies + run: pip install -e . -r requirements.txt + + - name: Run mypy + run: python -m mypy dj_database_url + + - name: Run pyright + run: python -m pyright dj_database_url + test: runs-on: ubuntu-latest strategy: @@ -30,14 +49,7 @@ jobs: cache: 'pip' - name: Install dependencies - run: | - pip install -r requirements.txt - pip install "Django~=${{ matrix.django-version }}.0" . - - - name: Run type checking - run: | - python -m mypy dj_database_url - python -m pyright dj_database_url + run: pip install -r requirements.txt "Django~=${{ matrix.django-version }}.0" . - name: Run Tests run: | @@ -47,10 +59,3 @@ jobs: coverage xml - uses: codecov/codecov-action@v4 - - - name: Check types installation - run: | - pip install . - cd tests - python -m mypy . - python -m pyright . From 59b3cd628399490db3d4389a87fd4c1cfe7225ea Mon Sep 17 00:00:00 2001 From: Matt Seymour Date: Fri, 19 Dec 2025 09:17:33 +0000 Subject: [PATCH 2/2] Update workflow to be uv compatable --- .github/workflows/test.yml | 52 ++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d732aa5..1b79342 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,58 +4,56 @@ jobs: typecheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 with: - python-version: '3.13' - cache: 'pip' - - - name: Install dependencies - run: pip install -e . -r requirements.txt + python-version: "3.12" - name: Run mypy - run: python -m mypy dj_database_url + run: uvx mypy dj_database_url - name: Run pyright - run: python -m pyright dj_database_url + run: uvx pyright dj_database_url test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] - django-version: ["4.2", "5.1"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + django-version: ["4.2", "5.2", "6.0"] exclude: - # Python 3.11 is not compatible with 3.2 - - python-version: "3.11" - django-version: "3.2" - - python-version: "3.12" - django-version: "3.2" + # django 4.x is not compatible with python 3.13 or higher - python-version: "3.13" - django-version: "3.2" - # django 5.x is not compatible with python 3.9 or lower - - python-version: "3.9" - django-version: "5.1" + django-version: "4.2" + - python-version: "3.14" + django-version: "4.2" + # django 6.x is not compatible with python 3.11 or lower + - python-version: "3.10" + django-version: "6.0" + - python-version: "3.11" + django-version: "6.0" steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv and set the Python version + uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} - cache: 'pip' + activate-environment: 'true' - name: Install dependencies - run: pip install -r requirements.txt "Django~=${{ matrix.django-version }}.0" . + run: | + uv pip install "Django~=${{ matrix.django-version }}.0" - name: Run Tests run: | echo "$(python --version) / Django $(django-admin --version)" - coverage run --source=dj_database_url --branch -m unittest discover -v - coverage report - coverage xml + uvx coverage run --source=dj_database_url --branch -m unittest discover -v + uvx coverage report + uvx coverage xml - uses: codecov/codecov-action@v4