-
Notifications
You must be signed in to change notification settings - Fork 269
128 lines (110 loc) · 3.99 KB
/
test.yml
File metadata and controls
128 lines (110 loc) · 3.99 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
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"
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