Skip to content

Commit 94e2f7a

Browse files
erikvwclaude
andcommitted
Add postgres to CI build matrix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ac977c1 commit 94e2f7a

4 files changed

Lines changed: 56 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ jobs:
88
build:
99
name: >-
1010
build (Python ${{ matrix.python-version }},
11-
Django ${{ matrix.django-version }})
11+
Django ${{ matrix.django-version }},
12+
${{ matrix.database }})
1213
runs-on: ubuntu-latest
1314

1415
strategy:
1516
fail-fast: false
1617
matrix:
1718
python-version: ['3.12', '3.13', '3.14']
1819
django-version: ['5.2', '6.0', 'dev']
20+
database: ['mysql', 'postgres']
1921

2022
services:
2123
mysql:
@@ -32,6 +34,20 @@ jobs:
3234
--health-timeout=5s
3335
--health-retries=3
3436
37+
postgres:
38+
image: postgres:latest
39+
env:
40+
POSTGRES_DB: test_db
41+
# pragma: allowlist secret
42+
POSTGRES_PASSWORD: postgres
43+
ports:
44+
- 5432:5432
45+
options: >-
46+
--health-cmd pg_isready
47+
--health-interval 10s
48+
--health-timeout 5s
49+
--health-retries 5
50+
3551
steps:
3652
- name: Install pycups and words dependency
3753
run: |
@@ -59,5 +75,7 @@ jobs:
5975
fi
6076
6177
- name: Run tests
78+
env:
79+
SELECTED_DATABASE: ${{ matrix.database }}
6280
run: |
6381
uv run --dev --no-sources runtests.py

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies = [
1212
[dependency-groups]
1313
dev = [
1414
"clinicedc-tests>=1.2.2",
15+
"psycopg>=3.2",
1516
"ruff>=0.15.15",
1617
"sphinx>=9.1.0",
1718
]

src/edc_cdisc/tests/test_settings.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23
from datetime import datetime
34
from importlib.resources import files
@@ -123,5 +124,25 @@
123124
add_lab_dashboard_middleware=True,
124125
).settings
125126

127+
if os.environ.get("SELECTED_DATABASE") == "postgres":
128+
project_settings["DATABASES"] = {
129+
"default": {
130+
"ENGINE": "django.db.backends.postgresql",
131+
"NAME": "test_db",
132+
"USER": "postgres",
133+
"PASSWORD": "postgres",
134+
"HOST": "127.0.0.1",
135+
"PORT": 5432,
136+
},
137+
"client": {
138+
"ENGINE": "django.db.backends.postgresql",
139+
"NAME": "test_db2",
140+
"USER": "postgres",
141+
"PASSWORD": "postgres",
142+
"HOST": "127.0.0.1",
143+
"PORT": 5432,
144+
},
145+
}
146+
126147
for k, v in project_settings.items():
127148
setattr(sys.modules[__name__], k, v)

uv.lock

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

0 commit comments

Comments
 (0)