Skip to content

Commit 041b637

Browse files
committed
chore: update CI to use postgres for tests
1 parent d36fe25 commit 041b637

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.github/workflows/backend-test.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,31 @@ name: Run Backend Tests
22

33
on:
44
pull_request:
5-
branches: [main]
5+
paths:
6+
- "backend/**"
7+
- ".github/workflows/backend-test.yml"
68
push:
79
branches: [main]
810

911
jobs:
1012
backend-test:
1113
runs-on: ubuntu-latest
1214

15+
services:
16+
postgres:
17+
image: postgres:latest
18+
env:
19+
POSTGRES_USER: postgres
20+
POSTGRES_PASSWORD: postgres
21+
POSTGRES_DB: ocsl_test
22+
ports:
23+
- 5432:5432
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
1330
steps:
1431
- name: Checkout code
1532
uses: actions/checkout@v4
@@ -32,6 +49,11 @@ jobs:
3249
PYTHONPATH=backend:backend/src pytest backend/test -v --tb=long --junitxml=backend/test-results/junit.xml
3350
env:
3451
GOOGLE_MAPS_API_KEY: "test_api_key_not_used"
52+
POSTGRES_USER: postgres
53+
POSTGRES_PASSWORD: postgres
54+
POSTGRES_HOST: localhost
55+
POSTGRES_PORT: 5432
56+
POSTGRES_DB: ocsl_test
3557

3658
- name: Publish Test Results
3759
uses: EnricoMi/publish-unit-test-result-action@v2

0 commit comments

Comments
 (0)