Repository navigation
194 lines (166 loc) · 5.8 KB
/
Copy pathci.yml
File metadata and controls
194 lines (166 loc) · 5.8 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Backend lint and test
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
FRONTEND_ORIGIN: http://localhost:5173
LOG_LEVEL: WARNING
DEMO_API_KEY_ENV: LLMBENCHLAB_CI_UNUSED_API_KEY
defaults:
run:
working-directory: backend
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Configure isolated temporary SQLite
run: echo "LLMBENCHLAB_DATABASE_URL=sqlite:///${RUNNER_TEMP}/llmbenchlab-ci.db" >> "$GITHUB_ENV"
- name: Install uv
run: python -m pip install --disable-pip-version-check uv==0.11.32
- name: Install locked backend dependencies
run: uv sync --frozen --extra dev
- name: Ruff lint
run: uv run ruff check .
- name: Ruff format check
run: uv run ruff format --check .
- name: SQLite migration upgrade, downgrade, upgrade, and check
run: |
uv run python -m app.db.prepare_migrations
uv run alembic upgrade head
uv run alembic downgrade 20260824_0001
uv run alembic upgrade head
uv run alembic check
- name: Backend tests (offline Mock and temporary SQLite)
run: uv run pytest -m "not integration"
backend-integration:
name: Backend PostgreSQL and Redis integration
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
FRONTEND_ORIGIN: http://localhost:5173
LOG_LEVEL: WARNING
DEMO_API_KEY_ENV: LLMBENCHLAB_CI_UNUSED_API_KEY
LLMBENCHLAB_DATABASE_URL: postgresql+psycopg://llmbenchlab:llmbenchlab-ci-only@127.0.0.1:5432/llmbenchlab_test
LLMBENCHLAB_REDIS_URL: redis://127.0.0.1:6379/15
LLMBENCHLAB_TEST_POSTGRES_URL: postgresql+psycopg://llmbenchlab:llmbenchlab-ci-only@127.0.0.1:5432/llmbenchlab_test
LLMBENCHLAB_TEST_REDIS_URL: redis://127.0.0.1:6379/15
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: llmbenchlab_test
POSTGRES_USER: llmbenchlab
POSTGRES_PASSWORD: llmbenchlab-ci-only
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U llmbenchlab -d llmbenchlab_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10
defaults:
run:
working-directory: backend
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: python -m pip install --disable-pip-version-check uv==0.11.32
- name: Install locked backend dependencies
run: uv sync --frozen --extra dev
- name: PostgreSQL migration upgrade, downgrade, upgrade, and check
run: |
uv run python -m app.db.prepare_migrations
uv run alembic upgrade head
uv run alembic downgrade 20260824_0001
uv run alembic upgrade head
uv run alembic check
- name: Real infrastructure integration tests (skips forbidden)
run: |
uv run pytest -m integration tests -ra \
--junitxml="${RUNNER_TEMP}/backend-integration.xml"
python - <<'PY'
import os
from pathlib import Path
from xml.etree import ElementTree
report = Path(os.environ["RUNNER_TEMP"]) / "backend-integration.xml"
cases = list(ElementTree.parse(report).getroot().iter("testcase"))
skipped = [case for case in cases if case.find("skipped") is not None]
if not cases:
raise SystemExit("No backend integration tests were collected")
if skipped:
names = ", ".join(case.attrib.get("name", "unknown") for case in skipped)
raise SystemExit(f"Backend integration tests skipped unexpectedly: {names}")
print(f"Verified {len(cases)} backend integration tests with zero skips")
PY
full-stack-reliability:
name: Real Compose reliability acceptance
runs-on: ubuntu-24.04
timeout-minutes: 35
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Run isolated PostgreSQL, Redis, API, Worker, and frontend fault tests
run: python3 scripts/phase2_acceptance.py
- name: Upload sanitized reliability evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: phase2-reliability-evidence-${{ github.run_id }}
path: .pytest_cache/artifacts/phase2-acceptance
if-no-files-found: warn
retention-days: 7
frontend:
name: Frontend lint, test, and build
runs-on: ubuntu-24.04
timeout-minutes: 15
defaults:
run:
working-directory: frontend
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install locked frontend dependencies
run: npm ci
- name: Frontend lint
run: npm run lint
- name: Frontend tests
run: npm test
- name: Frontend production build
env:
VITE_API_BASE_URL: /api/v1
run: npm run build