Repository navigation
168 lines (140 loc) · 4.48 KB
/
Copy pathci.yml
File metadata and controls
168 lines (140 loc) · 4.48 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
# CI for PerfReviewBot — runs the full test pyramid on every push/PR.
# Evals run on a weekly schedule + manual trigger (they cost tokens).
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Manual trigger from the Actions tab
workflow_dispatch:
# Weekly eval run (Monday 06:00 UTC) — rate-limited, costs tokens
schedule:
- cron: "0 6 * * 1"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.12"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: pip install ".[dev]"
- name: Ruff check
run: pip install -e ".[dev]" && ruff check app/ tests/
- name: Ruff format (check only)
run: ruff format --check app/ tests/
unit-and-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Unit + API tests (stubbed LLM)
env:
LLM_PROVIDER: stub
DATABASE_URL: sqlite:///./test.db
SECRET_KEY: test-secret-ci
run: |
pytest tests/unit tests/api -v --tb=short --no-header
- name: Upload test report (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-report-unit-api
path: .pytest_cache/
retention-days: 7
ui:
runs-on: ubuntu-latest
needs: [unit-and-api]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"
- name: Install system deps for Playwright
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2t64
- name: Install Python deps
run: pip install -e ".[dev]"
- name: Install Playwright browsers
run: playwright install --with-deps chromium
- name: Build frontend
run: |
cd frontend
npm ci
npm run build
- name: Start the app (stubbed LLM)
env:
LLM_PROVIDER: stub
ASSESS_RATE_LIMIT_PER_HOUR: "0"
DATABASE_URL: sqlite:///./test.db
SECRET_KEY: test-secret-ci
run: |
uvicorn app.main:app --host 0.0.0.0 --port 8000 &
APP_PID=$!
# Wait for the server to be ready
for i in $(seq 1 30); do
if curl -s http://localhost:8000/docs > /dev/null 2>&1; then
break
fi
sleep 1
done
echo "Server PID: $APP_PID"
- name: Run UI tests
env:
BASE_URL: http://localhost:8000
run: |
pytest tests/ui -v --tb=short --no-header -m ui
- name: Upload Playwright report (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7
evals:
if: false
runs-on: ubuntu-latest
needs: [unit-and-api]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run evals
env:
LLM_PROVIDER: gemini
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GEMINI_MODEL: gemini-3.6-flash
DATABASE_URL: sqlite:///./test.db
SECRET_KEY: test-secret-ci
run: |
pytest tests/evals -v --tb=short --no-header -m evals
# Evals are expected to be slow; give them time
timeout-minutes: 30