-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 2.54 KB
/
postgres-tests.yml
File metadata and controls
85 lines (73 loc) · 2.54 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: postgres-tests
on:
pull_request:
paths:
- 'packages/cli/**'
- 'packages/web/backend/**'
- '.github/workflows/postgres-tests.yml'
push:
branches: [main]
workflow_dispatch:
jobs:
conformance:
name: Chain protocol conformance against real Postgres
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: opentools
POSTGRES_PASSWORD: opentools
POSTGRES_DB: opentools_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U opentools"
--health-interval=5s
--health-timeout=3s
--health-retries=10
env:
# asyncpg URL for runtime code + SQLAlchemy async engine
DATABASE_URL: postgresql+asyncpg://opentools:opentools@localhost:5432/opentools_test
# Consumed by the conformance fixture to switch the postgres_async
# parameter from sqlite+aiosqlite to real Postgres
WEB_TEST_DB_URL: postgresql+asyncpg://opentools:opentools@localhost:5432/opentools_test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- name: Install CLI + web backend in editable mode
run: |
python -m pip install --upgrade pip
pip install -e packages/cli
pip install -e packages/web/backend
pip install 'pytest>=9.0' pytest-asyncio httpx aiosqlite asyncpg
- name: Wait for Postgres to be ready
run: |
for i in {1..30}; do
if pg_isready -h localhost -p 5432 -U opentools; then
echo "postgres ready"
exit 0
fi
sleep 1
done
echo "postgres failed to become ready"
exit 1
- name: Apply Alembic migrations
working-directory: packages/web/backend
run: alembic upgrade head
- name: Run chain protocol conformance (both backends)
run: |
pytest packages/cli/tests/chain/test_store_protocol_conformance.py \
packages/cli/tests/chain/test_store_protocol_shape.py \
-v --tb=short
- name: Run web backend integration tests
run: |
pytest packages/web/backend/tests/test_chain_api.py \
packages/web/backend/tests/test_chain_isolation.py \
packages/web/backend/tests/test_web_rebuild.py \
-v --tb=short
- name: Run full test suite
run: pytest packages/ -q