-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (181 loc) · 5.98 KB
/
Copy pathci.yml
File metadata and controls
211 lines (181 loc) · 5.98 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
PYTHON_VERSION: "3.13"
jobs:
test:
name: Unit Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gis_agent_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libspatialindex-dev \
postgresql-client \
gdal-bin \
libgdal-dev
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gis_agent_test
CHAINLIT_AUTH_SECRET: ci-test-secret-key-not-for-production
run: |
python -m pytest data_agent/ \
--ignore=data_agent/test_knowledge_agent.py \
--junitxml=test-results/junit.xml \
-q
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results/
frontend:
name: Frontend Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install and build
working-directory: frontend
run: |
npm ci
npm run build
evaluate:
name: Agent Evaluation (Full)
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libspatialindex-dev \
gdal-bin \
libgdal-dev
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Run multi-pipeline evaluation
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
GOOGLE_CLOUD_LOCATION: us-central1
run: |
python data_agent/run_evaluation.py
- name: Check evaluation results
if: always()
run: |
python -c "
import json, sys
with open('data_agent/eval_results/eval_summary.json') as f:
s = json.load(f)
print(f'Passed: {s[\"total_passed\"]}/{s[\"total_tests\"]}')
verdicts = s.get('pipeline_verdicts', {})
thresholds = s.get('thresholds', {})
for name, p in s['pipelines'].items():
if p.get('status') in ('skipped', 'crashed'):
st = p['status'].upper()
else:
rate = p.get('pass_rate', 0)
thr = thresholds.get(name, 0.6)
v = 'PASS' if verdicts.get(name, False) else 'FAIL'
st = f'{p.get(\"passed\",0)}/{p.get(\"total\",0)} ({rate:.0%} >= {thr:.0%} -> {v})'
print(f' {name}: {st}')
if not s['overall_pass']:
print('EVALUATION FAILED')
sys.exit(1)
"
- name: Upload evaluation results
if: always()
uses: actions/upload-artifact@v4
with:
name: eval-results
path: data_agent/eval_results/
route-eval:
name: Route Evaluation (PR)
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libspatialindex-dev \
gdal-bin \
libgdal-dev
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Run route evaluation (general pipeline only)
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
GOOGLE_CLOUD_LOCATION: us-central1
run: |
python data_agent/run_evaluation.py general
- name: Check route evaluation result
if: always()
run: |
python -c "
import json, sys
with open('data_agent/eval_results/eval_summary.json') as f:
s = json.load(f)
verdict = s.get('pipeline_verdicts', {}).get('general', False)
rate = s['pipelines'].get('general', {}).get('pass_rate', 0)
thr = s.get('thresholds', {}).get('general', 0.7)
print(f'General pipeline: {rate:.0%} (threshold {thr:.0%}) -> {\"PASS\" if verdict else \"FAIL\"}')
if not verdict:
print('ROUTE EVALUATION FAILED')
sys.exit(1)
"
- name: Upload route eval results
if: always()
uses: actions/upload-artifact@v4
with:
name: route-eval-results
path: data_agent/eval_results/