Skip to content

Commit 2e68810

Browse files
Add Django version matrix testing to CI/CD workflow (#66)
This PR makes the supported Django versions explicit for the project. This includes the following changes: - Add Django to the matrix tests to build and test for each Python version and each Django version - Add supported Django versions to `README.md` - Fixed incorrect version check in `utils.py` - Publish `Framework` metadata for PyPI - Modify `django` dev requirement version to be more general By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent aec95ea commit 2e68810

File tree

5 files changed

+64
-18
lines changed

5 files changed

+64
-18
lines changed

.github/workflows/cicd.yml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,42 @@ on:
1515

1616
jobs:
1717
integration-tests:
18-
name: Python v${{ matrix.version }}
19-
runs-on: ubuntu-latest
18+
name: Python v${{ matrix.python-version }} - Django ${{ matrix.django-version }}
19+
runs-on: ubuntu-latest
2020
strategy:
2121
# If we run more than one job at a time, we will have to have one cluster
2222
# for each flavor of the job. Otherwise they will interfere with each other
2323
# These tests are quite fast. We don't need to have many clusters.
2424
max-parallel: 1
2525
matrix:
26-
# Run test for every python version we intend to support.
27-
version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
26+
# Run test for every Python and Django version we intend to support.
27+
python-version:
28+
- '3.8'
29+
- '3.9'
30+
- '3.10'
31+
- '3.11'
32+
- '3.12'
33+
- '3.13'
34+
django-version:
35+
- 'default'
36+
- '>=4.2,<4.3'
37+
- '>=5.0,<5.1'
38+
- '>=5.1,<5.2'
39+
- '>=5.2,<5.3'
40+
exclude:
41+
# Django 5.0+ requires Python 3.10+
42+
- python-version: '3.8'
43+
django-version: '>=5.0,<5.1'
44+
- python-version: '3.8'
45+
django-version: '>=5.1,<5.2'
46+
- python-version: '3.8'
47+
django-version: '>=5.2,<5.3'
48+
- python-version: '3.9'
49+
django-version: '>=5.0,<5.1'
50+
- python-version: '3.9'
51+
django-version: '>=5.1,<5.2'
52+
- python-version: '3.9'
53+
django-version: '>=5.2,<5.3'
2854
permissions:
2955
id-token: write
3056
contents: read
@@ -36,14 +62,11 @@ jobs:
3662
steps:
3763
- name: Checkout code
3864
uses: actions/checkout@v5
39-
# with:
40-
# # For pull requests, check out the base branch, not the PR branch
41-
# ref: ${{ github.event.pull_request.base.sha }}
4265

43-
- name: Set up Python ${{ matrix.version }}
66+
- name: Set up Python ${{ matrix.python-version }}
4467
uses: actions/setup-python@v6
4568
with:
46-
python-version: ${{ matrix.version }}
69+
python-version: ${{ matrix.python-version }}
4770

4871
- name: Install uv
4972
uses: astral-sh/setup-uv@v6
@@ -57,9 +80,19 @@ jobs:
5780
- name: Setup dependencies
5881
run: |
5982
uv sync --extra test --extra dev
60-
uv run python3 -c "import boto3; print(boto3.__version__)"
83+
uv run python -c "import boto3; print(boto3.__version__)"
6184
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
6285
86+
# Install specific Django version for matrix testing, skip for 'default' to verify pyproject.toml version
87+
- name: Install Django ${{ matrix.django-version }}
88+
if: matrix.django-version != 'default'
89+
run: |
90+
uv pip install "django${{ matrix.django-version }}"
91+
92+
- name: Print Django version
93+
run: |
94+
uv run python -c "import django; print(f'Django version: {django.get_version()}')"
95+
6396
- name: Lint with ruff
6497
run: |
6598
# Check code formatting
@@ -79,17 +112,17 @@ jobs:
79112
DJANGO_SETTINGS_MODULE: aurora_dsql_django.tests.test_settings
80113
run: |
81114
uv run pytest --cov=aurora_dsql_django aurora_dsql_django/tests/unit/ --cov-report=xml
82-
115+
83116
- name: Debug test results
84117
if: always()
85118
run: |
86119
cat coverage.xml || echo "coverage.xml not found"
87-
120+
88121
- name: Archive code coverage results
89122
uses: actions/upload-artifact@v4
90123
with:
91-
name: code-coverage-report
92-
path: coverage-v${{ matrix.version }}.xml
124+
name: code-coverage-report-${{ github.job }}-${{ strategy.job-index }}
125+
path: coverage.xml
93126

94127
- name: Run integration tests
95128
env:

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ This is the adapter for enabling development of Django applications using Aurora
66

77
## Requirements
88

9+
### Django
10+
11+
Aurora DSQL adapter for Django supports Django 4.2+ with the following versions:
12+
- Django 4.2.x (LTS)
13+
- Django 5.0.x
14+
- Django 5.1.x
15+
- Django 5.2.x (LTS)
16+
917
### Boto3
1018

1119
Aurora DSQL Django adapter needs boto3 to work. Follow the Boto3 [installation guide](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html) to install Boto3

aurora_dsql_django/tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# noinspection PyArgumentList
88
def create_check_constraint(condition, name):
99
"""Create CheckConstraint with Django version compatibility"""
10-
if django.VERSION >= (5, 0):
10+
if django.VERSION >= (5, 1):
1111
return CheckConstraint(condition=condition, name=name)
1212
else:
1313
return CheckConstraint(check=condition, name=name)

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ classifiers = [
2020
"Programming Language :: Python :: 3.11",
2121
"Programming Language :: Python :: 3.12",
2222
"Programming Language :: Python :: 3.13",
23+
"Framework :: Django",
24+
"Framework :: Django :: 4.2",
25+
"Framework :: Django :: 5.0",
26+
"Framework :: Django :: 5.1",
27+
"Framework :: Django :: 5.2",
2328
]
2429

2530
[project.urls]
@@ -28,7 +33,7 @@ Repository = "https://github.com/awslabs/aurora-dsql-django"
2833
[project.optional-dependencies]
2934
test = [
3035
"pytest>=8",
31-
"django>=4.2.16",
36+
"django>=4.2",
3237
"wheel",
3338
"psycopg2-binary",
3439
"psycopg",

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)