Skip to content

Commit 5027846

Browse files
committed
Add github CI workflow test-migrations
1 parent 96c1248 commit 5027846

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test migrations
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_call:
7+
pull_request:
8+
9+
env:
10+
UV_FROZEN: true # Do not update the lockfile
11+
12+
jobs:
13+
test_migrations:
14+
name: Test migrations
15+
runs-on: ubuntu-latest
16+
container: ghcr.io/astral-sh/uv:python3.13-bookworm-slim
17+
env:
18+
DATABASE_URI: postgresql://nwa:nwa@postgres/orchestrator-core
19+
services:
20+
postgres:
21+
image: postgres:17-alpine
22+
env:
23+
POSTGRES_PASSWORD: nwa
24+
POSTGRES_USER: nwa
25+
POSTGRES_DB: orchestrator-core
26+
# Set health checks to wait until postgres has started
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
steps:
33+
- name: Check out repository code
34+
uses: actions/checkout@v3
35+
36+
- name: Install dependencies
37+
run: uv sync
38+
39+
- name: Test migrations
40+
run: uv run main.py db upgrade heads
41+
42+
- name: Verify 2 migration heads
43+
run: |
44+
num_heads=$(uv run main.py db heads | grep -c '(head)')
45+
if [ "$num_heads" -ne 2 ];
46+
echo "Found $num_heads DB heads instead of 2"
47+
exit 1
48+
fi

0 commit comments

Comments
 (0)