Skip to content

Commit 927137c

Browse files
committed
Test on PostgreSQL
1 parent bdf0dff commit 927137c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ jobs:
1616

1717
test:
1818
runs-on: ubuntu-latest
19+
services:
20+
postgres:
21+
image: postgres
22+
env:
23+
POSTGRES_DB: dbtasks
24+
POSTGRES_PASSWORD: secret
25+
options: >-
26+
--health-cmd pg_isready
27+
--health-interval 10s
28+
--health-timeout 5s
29+
--health-retries 5
30+
ports:
31+
- 5432:5432
1932
strategy:
2033
matrix:
2134
django-version: ["6.0"]
@@ -30,3 +43,8 @@ jobs:
3043
uses: astral-sh/setup-uv@v7
3144
- name: Run Tests (SQLite)
3245
run: uv run --with "django~=${{ matrix.django-version }}" manage.py test
46+
- name: Run Tests (PostgreSQL)
47+
run: uv run --with "django~=${{ matrix.django-version }}" manage.py test
48+
env:
49+
TEST_ENGINE: postgres
50+
POSTGRES_PASSWORD: secret

tests/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
DATABASES = {
88
"default": {
99
"ENGINE": "django.db.backends.postgresql",
10-
"NAME": "dbtasks",
10+
"NAME": os.getenv("POSTGRES_DB", "dbtasks"),
11+
"USER": os.getenv("POSTGRES_USER", "postgres"),
12+
"PASSWORD": os.getenv("POSTGRES_PASSWORD", ""),
13+
"HOST": os.getenv("POSTGRES_HOST", "localhost"),
14+
"PORT": os.getenv("POSTGRES_PORT", 5432),
1115
}
1216
}
1317
else:

0 commit comments

Comments
 (0)