-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (47 loc) · 1.24 KB
/
python-pgsql.yaml
File metadata and controls
57 lines (47 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: FastAPI backend with PostgreSQL
permissions: {}
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: backend
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install backend
run: |
pipx install poetry
poetry sync -E pg
- name: Create test database
run: psql -h localhost -U postgres -c 'CREATE DATABASE "acidwatch_test";'
env:
PGPASSWORD: password
- name: Run pytest
run: |
poetry run alembic upgrade head
poetry run pytest tests --test-alembic
env:
ACIDWATCH_DATABASE: postgresql://postgres:password@localhost:5432/postgres
ACIDWATCH_TEST_DATABASE: postgresql://postgres:password@localhost:5432/acidwatch_test