-
Notifications
You must be signed in to change notification settings - Fork 264
269 lines (227 loc) · 8.44 KB
/
test.yml
File metadata and controls
269 lines (227 loc) · 8.44 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: Run Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r tests/requirements.txt
pip install -e .
- name: Run unit tests (no server required)
run: |
# Set up local inference environment
export OPTILLM_API_KEY=optillm
# Run tests that don't need server - fast feedback!
python tests/test_ci_quick.py
python -m pytest tests/test_plugins.py -v --tb=short || python tests/test_plugins.py
python tests/test_approaches.py
python tests/test_reasoning_simple.py
python tests/test_batching.py
env:
OPTILLM_API_KEY: optillm
HF_TOKEN: ${{ secrets.HF_TOKEN }}
integration-tests:
runs-on: ubuntu-latest
needs: unit-tests # Only run if unit tests pass
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r tests/requirements.txt
pip install -e .
- name: Start optillm server
run: |
echo "Starting optillm server for integration tests..."
OPTILLM_API_KEY=optillm python optillm.py --model google/gemma-3-270m-it --port 8000 &
echo $! > server.pid
# Wait for server to be ready
echo "Waiting for server to start..."
sleep 15
# Test server health
curl -s http://localhost:8000/health || echo "Server health check failed"
env:
OPTILLM_API_KEY: optillm
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: Run integration tests (server required)
run: |
# Run tests that need the server
echo "Running tests that require optillm server..."
OPTILLM_API_KEY=optillm python tests/test_reasoning_tokens.py
OPTILLM_API_KEY=optillm python tests/test_reasoning_integration.py
OPTILLM_API_KEY=optillm python tests/test_json_plugin.py
OPTILLM_API_KEY=optillm python tests/test_n_parameter.py
OPTILLM_API_KEY=optillm python -m pytest tests/test_api_compatibility.py -v --tb=short || echo "API compatibility tests require pytest"
OPTILLM_API_KEY=optillm python tests/test.py --approaches none --single-test "Simple Math Problem" || echo "Main test completed"
# Run SSL config tests (no server needed but requires proper env setup)
echo "Running SSL config tests..."
python -m pytest tests/test_ssl_config.py -v --tb=short
# Run MARS tests
echo "Running MARS parallel tests..."
OPTILLM_API_KEY=optillm python -m pytest tests/test_mars_parallel.py -v --tb=short
# Run deepconf tests
echo "Running deepconf tests..."
OPTILLM_API_KEY=optillm python -m pytest tests/test_deepconf.py -v --tb=short
# Run conversation logger unit tests (no server needed)
echo "Running conversation logger tests..."
python -m pytest tests/test_conversation_logger.py -v --tb=short
echo "All integration tests completed successfully!"
exit 0
env:
OPTILLM_API_KEY: optillm
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: Stop optillm server
if: always()
run: |
echo "Stopping optillm server..."
if [ -f server.pid ]; then
kill $(cat server.pid) 2>/dev/null || true
rm -f server.pid
fi
# Kill any remaining python processes running optillm
pkill -f "python.*optillm" 2>/dev/null || true
sleep 2
echo "Server shutdown completed"
exit 0
conversation-logging-tests:
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r tests/requirements.txt
pip install -e .
- name: Start optillm server with conversation logging
run: |
echo "Starting optillm server with conversation logging..."
mkdir -p /tmp/optillm_conversations
OPTILLM_API_KEY=optillm python optillm.py \
--model google/gemma-3-270m-it \
--port 8000 \
--log-conversations \
--conversation-log-dir /tmp/optillm_conversations &
echo $! > server.pid
# Wait for server to be ready
echo "Waiting for server to start..."
sleep 20
# Test server health
curl -s http://localhost:8000/health || echo "Server health check failed"
env:
OPTILLM_API_KEY: optillm
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: Run conversation logging tests
run: |
echo "Running conversation logging approach tests..."
OPTILLM_API_KEY=optillm python -m pytest tests/test_conversation_logging_approaches.py -v --tb=short
echo "Running conversation logging server tests..."
OPTILLM_API_KEY=optillm OPTILLM_CONVERSATION_LOG_DIR=/tmp/optillm_conversations python -m pytest tests/test_conversation_logging_server.py -v --tb=short
echo "All conversation logging tests completed successfully!"
env:
OPTILLM_API_KEY: optillm
OPTILLM_CONVERSATION_LOG_DIR: /tmp/optillm_conversations
HF_TOKEN: ${{ secrets.HF_TOKEN }}
- name: Stop optillm server
if: always()
run: |
echo "Stopping optillm server..."
if [ -f server.pid ]; then
kill $(cat server.pid) 2>/dev/null || true
rm -f server.pid
fi
pkill -f "python.*optillm" 2>/dev/null || true
sleep 2
echo "Server shutdown completed"
exit 0
mcp-tests:
runs-on: ubuntu-latest
needs: unit-tests
if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only run on main branch pushes (secrets available)
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r tests/requirements.txt
pip install -e .
- name: Run MCP plugin tests
run: |
echo "Running MCP plugin tests..."
python -m pytest tests/test_mcp_plugin.py -v --tb=short
echo "MCP tests completed successfully!"
env:
OPTILLM_API_KEY: optillm
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}