-
Notifications
You must be signed in to change notification settings - Fork 2k
237 lines (216 loc) · 8.56 KB
/
Copy pathapi_test_effect.yml
File metadata and controls
237 lines (216 loc) · 8.56 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
name: 07. API Effect Tests
on:
workflow_dispatch:
schedule:
- cron: '0 1,10 * * *'
release:
types: [prereleased]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
effect-tests:
name: API Effect Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 120
if: github.event_name == 'workflow_dispatch' || github.repository == 'volcengine/OpenViking'
strategy:
fail-fast: false
max-parallel: 1
matrix:
os: [ubuntu-24.04]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 100
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Cache Python dependencies
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-effect-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-effect-
- name: Install system dependencies
run: |
sudo apt-get update -y && sudo apt-get install -y cmake build-essential ffmpeg --no-install-recommends
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install build dependencies (system pip)
run: |
python -m pip install --upgrade pip
pip install "setuptools>=70.1" setuptools_scm cmake wheel
- name: Install dependencies using uv sync
run: uv sync --frozen
- name: Install build dependencies (uv pip)
run: uv pip install setuptools setuptools_scm cmake wheel maturin
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- name: Build C++ extensions
shell: bash
run: |
export OV_SKIP_OV_BUILD=1
mkdir -p openviking/bin
touch openviking/bin/ov
chmod +x openviking/bin/ov
if [ -z "$SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENVIKING" ]; then
PRETEND_VERSION=$(git describe --tags --always 2>/dev/null | sed -E 's/^v?([0-9]+\.[0-9]+\.[0-9]+).*/\1.dev0/' || echo "0.0.0.dev0")
echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENVIKING=$PRETEND_VERSION" >> $GITHUB_ENV
fi
uv run python setup.py build_ext --inplace
- name: Build ragfs-python native extension
shell: bash
run: |
RAGFS_LIB_DIR="openviking/lib"
RAGFS_SO_COUNT=$(ls -1 "$RAGFS_LIB_DIR"/ragfs_python*.so "$RAGFS_LIB_DIR"/ragfs_python*.pyd "$RAGFS_LIB_DIR"/ragfs_python*.dylib 2>/dev/null | wc -l | tr -d '[:space:]' || echo "0")
if [ "$RAGFS_SO_COUNT" -gt 0 ]; then exit 0; fi
TMPDIR_RAGFS=$(mktemp -d)
cd crates/ragfs-python
uv run --no-project maturin build --release --features s3 --out "$TMPDIR_RAGFS"
cd ../..
WHL_FILE=$(ls -1 "$TMPDIR_RAGFS"/ragfs_python-*.whl 2>/dev/null | head -1)
if [ -z "$WHL_FILE" ]; then exit 1; fi
mkdir -p "$RAGFS_LIB_DIR"
WHL_FILE_PY=$(echo "$WHL_FILE" | sed 's/\\/\\\\/g')
RAGFS_LIB_DIR_PY=$(echo "$RAGFS_LIB_DIR" | sed 's/\\/\\\\/g')
uv run python -c "
import zipfile, os, sys
with zipfile.ZipFile('${WHL_FILE_PY}') as zf:
for name in zf.namelist():
bn = os.path.basename(name)
if bn.startswith('ragfs_python') and (bn.endswith('.so') or bn.endswith('.pyd') or bn.endswith('.dylib')):
dst = os.path.join('${RAGFS_LIB_DIR_PY}', bn)
with zf.open(name) as src, open(dst, 'wb') as f:
f.write(src.read())
os.chmod(dst, 0o755)
sys.exit(0)
sys.exit(1)
"
rm -rf "$TMPDIR_RAGFS"
- name: Install API test dependencies
run: |
cd tests/api_test
uv pip install -r requirements.txt
- name: Create OpenViking config file
env:
VLM_API_KEY: ${{ secrets.VLM_API_KEY }}
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
run: |
mkdir -p $HOME/.openviking
if [ -n "$VLM_API_KEY" ] && [ -n "$EMBEDDING_API_KEY" ]; then
echo "HAS_SECRETS=true" >> $GITHUB_ENV
cat > $HOME/.openviking/ov.conf << EOF
{
"server": { "root_api_key": "test-root-api-key" },
"vlm": {
"provider": "volcengine",
"api_key": "$VLM_API_KEY",
"model": "doubao-seed-2-0-mini-260215",
"api_base": "https://ark.cn-beijing.volces.com/api/v3",
"temperature": 0.1, "max_retries": 3
},
"embedding": {
"dense": {
"provider": "volcengine",
"api_key": "$EMBEDDING_API_KEY",
"model": "doubao-embedding-vision-251215",
"api_base": "https://ark.cn-beijing.volces.com/api/v3",
"dimension": 1024, "input": "multimodal"
}
}
}
EOF
else
echo "HAS_SECRETS=false" >> $GITHUB_ENV
cat > $HOME/.openviking/ov.conf << EOF
{
"server": { "root_api_key": "test-root-api-key" },
"vlm": {
"provider": "volcengine",
"api_key": "dummy-vlm-api-key",
"model": "doubao-seed-2-0-mini-260215",
"api_base": "https://ark.cn-beijing.volces.com/api/v3",
"temperature": 0.1, "max_retries": 3
},
"embedding": {
"dense": {
"provider": "volcengine",
"api_key": "dummy-embedding-api-key",
"model": "doubao-embedding-vision-251215",
"api_base": "https://ark.cn-beijing.volces.com/api/v3",
"dimension": 1024, "input": "multimodal"
}
}
}
EOF
fi
- name: Start OpenViking Server
run: |
SERVER_PORT=1933
echo "SERVER_PORT=$SERVER_PORT" >> $GITHUB_ENV
export ROOT_API_KEY=test-root-api-key
export SERVER_PORT=$SERVER_PORT
nohup uv run python -m openviking.server.bootstrap > openviking-server.log 2>&1 &
echo $! > openviking-server.pid
echo "Waiting for server to start..."
for i in {1..30}; do
if curl -s http://127.0.0.1:$SERVER_PORT/health | grep -q '"healthy":true'; then
echo "Server is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 2
done
if ! curl -s http://127.0.0.1:$SERVER_PORT/health | grep -q '"healthy":true'; then
echo "Server failed to start!"
cat openviking-server.log
exit 1
fi
- name: Run Effect Tests
id: run-effect-tests
run: |
cd tests/api_test
export OPENVIKING_API_KEY=test-root-api-key
export SERVER_URL=http://127.0.0.1:${{ env.SERVER_PORT }}
echo "Running lightweight slow tests (parallel with reduced workers)..."
uv run python -m pytest \
common/slow/ tasks/slow/ skills/slow/ retrieval/slow/ \
-v -n 2 --tb=short --durations=0 \
--html=api-effect-light-report.html --self-contained-html || true
echo "Running heavy slow tests (serial to avoid resource conflicts)..."
uv run python -m pytest \
content/slow/ resources/slow/ sessions/slow/ \
scenarios/slow/ scenarios/stability_error/slow/ \
scenarios/resources_retrieval_slow/ \
-v --tb=short --durations=0 \
--html=api-effect-heavy-report.html --self-contained-html
continue-on-error: true
- name: Upload test reports
uses: actions/upload-artifact@v7
if: always()
with:
name: api-effect-test-reports-${{ github.run_id }}
path: |
tests/api_test/api-effect-light-report.html
tests/api_test/api-effect-heavy-report.html
openviking-server.log
- name: Stop OpenViking Server
if: always()
run: |
if [ -f openviking-server.pid ]; then
kill $(cat openviking-server.pid) 2>/dev/null || true
pkill -f "openviking.server.bootstrap" 2>/dev/null || true
fi
- name: Check test results
if: steps.run-effect-tests.outcome != 'success'
run: |
echo "Effect tests failed!"
exit 1