-
Notifications
You must be signed in to change notification settings - Fork 91
74 lines (65 loc) · 2.08 KB
/
Copy pathci.yml
File metadata and controls
74 lines (65 loc) · 2.08 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
name: CI Workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- 'quantara/web_app/**'
- 'quantara/frontend/**'
- 'devops/**'
pull_request:
branches:
- main
paths:
- 'quantara/web_app/**'
- 'quantara/frontend/**'
- 'devops/**'
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: quantara
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start services and initialize database
run: |
docker compose -f devops/docker-compose.quantara.back.yaml up -d --build
echo "Waiting for backend to become healthy..."
for i in $(seq 1 60); do
if curl -sf http://localhost:8000/health > /dev/null 2>&1; then
echo "Backend healthy after $((i * 2))s"
break
fi
sleep 2
done
# Run only existing migrations (never autogenerate in CI)
docker compose -f devops/docker-compose.quantara.back.yaml exec -T backend poetry run alembic -c web_app/alembic.ini upgrade head
- name: Run tests
run: |
docker compose -f devops/docker-compose.quantara.back.yaml exec -T backend poetry run pytest web_app/tests -v
- name: Run tests with coverage
run: |
docker compose -f devops/docker-compose.quantara.back.yaml exec -T backend poetry run pytest web_app/tests --cov=web_app --cov-report=term-missing --cov-fail-under=60
- name: Tear down
if: always()
run: |
docker compose -f devops/docker-compose.quantara.back.yaml down -v