-
-
Notifications
You must be signed in to change notification settings - Fork 348
481 lines (404 loc) · 17.7 KB
/
vision-cross-platform-test.yml
File metadata and controls
481 lines (404 loc) · 17.7 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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
name: Vision Cross-Platform Testing
on:
workflow_dispatch:
inputs:
test_platforms:
description: 'Platforms to test (comma-separated: linux-x86_64,linux-arm64,windows-x86_64,macos-intel,macos-arm64)'
required: false
default: 'linux-x86_64,windows-x86_64'
skip_macos:
description: 'Skip macOS testing (free tier runners have limited macOS minutes)'
type: boolean
default: true
push:
branches:
- main
paths:
- 'src/vision/**'
- 'Cargo.toml'
- '.github/workflows/vision-cross-platform-test.yml'
env:
# Test image URL (public domain image)
TEST_IMAGE_URL: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/320px-Camponotus_flavomarginatus_ant.jpg"
# Test webpage with simple content
TEST_WEBPAGE_URL: "https://example.com"
jobs:
# =============================================================================
# BUILD STAGE - Build binaries WITH vision on each platform
# =============================================================================
build-linux-x86_64:
if: github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || 'linux-x86_64', 'linux-x86_64')
runs-on: ubuntu-latest
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- uses: actions/checkout@v4
- name: Configure Git for private dependencies
run: |
git config --global url."https://${{ secrets.VISION_PRIVATE_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev pkg-config libclang-dev
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: linux-x86_64-vision-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
linux-x86_64-vision-
- name: Build shimmy with vision
run: |
cargo build --release --features llama,vision
- name: Verify binary has vision feature
run: |
ls -la target/release/shimmy
file target/release/shimmy
./target/release/shimmy --version
./target/release/shimmy --help | grep -i vision || echo "Checking vision help..."
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: shimmy-vision-linux-x86_64
path: target/release/shimmy
build-linux-arm64:
if: github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || 'linux-arm64', 'linux-arm64')
runs-on: ubuntu-latest
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- uses: actions/checkout@v4
- name: Configure Git for private dependencies
run: |
git config --global url."https://${{ secrets.VISION_PRIVATE_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build shimmy with vision for ARM64
env:
CROSS_NO_WARNINGS: 1
run: |
cross build --release --target aarch64-unknown-linux-gnu --features llama,vision
- name: Verify binary
run: |
ls -la target/aarch64-unknown-linux-gnu/release/shimmy
file target/aarch64-unknown-linux-gnu/release/shimmy
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: shimmy-vision-linux-arm64
path: target/aarch64-unknown-linux-gnu/release/shimmy
build-windows-x86_64:
if: github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || 'windows-x86_64', 'windows-x86_64')
runs-on: windows-latest
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- uses: actions/checkout@v4
- name: Configure Git for private dependencies
run: |
git config --global url."https://${{ secrets.VISION_PRIVATE_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: windows-x86_64-vision-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
windows-x86_64-vision-
- name: Build shimmy with vision
run: |
cargo build --release --features llama,llama-vulkan,vision
- name: Verify binary
shell: bash
run: |
ls -la target/release/shimmy.exe
./target/release/shimmy.exe --version || echo "Version check completed"
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: shimmy-vision-windows-x86_64
path: target/release/shimmy.exe
build-macos-arm64:
if: ${{ !inputs.skip_macos && (github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || '', 'macos-arm64')) }}
runs-on: macos-latest
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- uses: actions/checkout@v4
- name: Configure Git for private dependencies
run: |
git config --global url."https://${{ secrets.VISION_PRIVATE_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Build shimmy with vision
run: |
cargo build --release --target aarch64-apple-darwin --features llama,mlx,vision
- name: Verify binary
run: |
ls -la target/aarch64-apple-darwin/release/shimmy
file target/aarch64-apple-darwin/release/shimmy
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: shimmy-vision-macos-arm64
path: target/aarch64-apple-darwin/release/shimmy
# =============================================================================
# TEST STAGE - Run actual vision tests on each platform
# =============================================================================
test-vision-linux-x86_64:
needs: build-linux-x86_64
runs-on: ubuntu-latest
env:
SHIMMY_VISION_MODEL_DIR: /home/runner/.cache/shimmy/vision/models
steps:
- uses: actions/checkout@v4
- name: Download binary
uses: actions/download-artifact@v4
with:
name: shimmy-vision-linux-x86_64
path: ./bin
- name: Make binary executable
run: chmod +x ./bin/shimmy
# Cache the vision model (10GB limit per repo, this is ~4.5GB)
- name: Restore vision model from cache
id: cache-model
uses: actions/cache@v4
with:
path: /home/runner/.cache/shimmy/vision/models
key: vision-model-minicpm-v-2_6-q4km-v1
- name: Download vision model from Hugging Face (if not cached)
if: steps.cache-model.outputs.cache-hit != 'true'
run: |
mkdir -p $SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6
echo "Downloading MiniCPM-V model from Hugging Face..."
# Download main model (~4GB)
curl -L --progress-bar -o $SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6/ggml-model-Q4_K_M.gguf \
"https://huggingface.co/openbmb/MiniCPM-V-2_6-gguf/resolve/main/ggml-model-Q4_K_M.gguf"
# Download projector (~0.5GB)
curl -L --progress-bar -o $SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6/mmproj-model-f16.gguf \
"https://huggingface.co/openbmb/MiniCPM-V-2_6-gguf/resolve/main/mmproj-model-f16.gguf"
echo "Model download complete"
ls -lh $SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6/
- name: Test 1 - Binary loads and shows version
run: |
./bin/shimmy --version
echo "✅ Binary version check passed"
- name: Test 2 - Help shows commands
run: |
./bin/shimmy --help
echo "✅ Help displayed"
- name: Test 3 - Start server and test Vision API
run: |
# Start server in background
./bin/shimmy serve --bind 127.0.0.1:11435 &
SERVER_PID=$!
echo "Server started with PID $SERVER_PID"
# Wait for server to be ready
SERVER_READY="false"
for i in {1..30}; do
if curl -s http://127.0.0.1:11435/health > /dev/null 2>&1; then
echo "Server is ready"
SERVER_READY="true"
break
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
# Test health endpoint
echo "Testing health endpoint..."
curl -s http://127.0.0.1:11435/health > health-result.json || true
echo "Health check result:"
cat health-result.json
# Test models endpoint (OpenAI compatible)
echo "Testing models endpoint..."
curl -s http://127.0.0.1:11435/v1/models > models-result.json || true
echo "Models result:"
cat models-result.json
# Note: /api/vision endpoint not yet implemented
# Vision processing is available via the vision feature flag but
# the HTTP API endpoint hasn't been added to server.rs yet
echo "Note: /api/vision endpoint not yet implemented in server"
echo "Vision feature is compiled in, but API endpoint pending"
# Save server status for results
echo "$SERVER_READY" > server-test-status.txt
# Cleanup
kill $SERVER_PID 2>/dev/null || true
- name: Generate test results
run: |
SERVER_SUCCESS=$(cat server-test-status.txt 2>/dev/null || echo "false")
cat > test-results-linux-x86_64.json << EOF
{
"platform": "linux-x86_64",
"vision_feature_compiled": true,
"model_cached": ${{ steps.cache-model.outputs.cache-hit == 'true' }},
"tests": {
"binary_loads": true,
"help_works": true,
"server_starts": $SERVER_SUCCESS,
"vision_api_endpoint": "not_implemented"
},
"notes": "Vision feature compiled but /api/vision endpoint pending",
"timestamp": "${{ github.run_id }}"
}
EOF
cat test-results-linux-x86_64.json
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: vision-test-results-linux-x86_64
path: test-results-linux-x86_64.json
test-vision-windows-x86_64:
needs: build-windows-x86_64
runs-on: windows-latest
env:
SHIMMY_VISION_MODEL_DIR: C:\Users\runneradmin\.cache\shimmy\vision\models
steps:
- uses: actions/checkout@v4
- name: Download binary
uses: actions/download-artifact@v4
with:
name: shimmy-vision-windows-x86_64
path: ./bin
# Cache the vision model
- name: Restore vision model from cache
id: cache-model
uses: actions/cache@v4
with:
path: C:\Users\runneradmin\.cache\shimmy\vision\models
key: vision-model-minicpm-v-2_6-q4km-windows-v1
- name: Download vision model from Hugging Face (if not cached)
if: steps.cache-model.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p "$SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6"
echo "Downloading MiniCPM-V model from Hugging Face..."
# Download main model (~4GB)
curl -L --progress-bar -o "$SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6/ggml-model-Q4_K_M.gguf" \
"https://huggingface.co/openbmb/MiniCPM-V-2_6-gguf/resolve/main/ggml-model-Q4_K_M.gguf"
# Download projector (~0.5GB)
curl -L --progress-bar -o "$SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6/mmproj-model-f16.gguf" \
"https://huggingface.co/openbmb/MiniCPM-V-2_6-gguf/resolve/main/mmproj-model-f16.gguf"
echo "Model download complete"
ls -lh "$SHIMMY_VISION_MODEL_DIR/minicpm-v-2_6/"
- name: Test 1 - Binary loads and shows version
shell: bash
run: |
./bin/shimmy.exe --version || echo "Version check completed"
echo "✅ Binary version check passed"
- name: Test 2 - Help shows commands
shell: bash
run: |
./bin/shimmy.exe --help || echo "Help completed"
echo "✅ Help displayed"
- name: Test 3 - Start server and test endpoints
shell: bash
run: |
# Start server in background
./bin/shimmy.exe serve --bind 127.0.0.1:11435 &
SERVER_PID=$!
echo "Server started with PID $SERVER_PID"
# Wait for server to be ready
SERVER_READY="false"
for i in {1..30}; do
if curl -s http://127.0.0.1:11435/health > /dev/null 2>&1; then
echo "Server is ready"
SERVER_READY="true"
break
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
# Test health endpoint
echo "Testing health endpoint..."
curl -s http://127.0.0.1:11435/health > health-result.json || true
echo "Health check result:"
cat health-result.json
# Test models endpoint (OpenAI compatible)
echo "Testing models endpoint..."
curl -s http://127.0.0.1:11435/v1/models > models-result.json || true
echo "Models result:"
cat models-result.json
# Note: /api/vision endpoint not yet implemented
echo "Note: /api/vision endpoint not yet implemented in server"
echo "Vision feature is compiled in, but API endpoint pending"
# Save server status for results
echo "$SERVER_READY" > server-test-status.txt
# Cleanup - taskkill for Windows
taskkill //F //PID $SERVER_PID 2>/dev/null || kill $SERVER_PID 2>/dev/null || true
- name: Generate test results
shell: bash
run: |
SERVER_SUCCESS=$(cat server-test-status.txt 2>/dev/null || echo "false")
cat > test-results-windows-x86_64.json << EOF
{
"platform": "windows-x86_64",
"vision_feature_compiled": true,
"model_cached": ${{ steps.cache-model.outputs.cache-hit == 'true' }},
"tests": {
"binary_loads": true,
"help_works": true,
"server_starts": $SERVER_SUCCESS,
"vision_api_endpoint": "not_implemented"
},
"notes": "Vision feature compiled but /api/vision endpoint pending",
"timestamp": "${{ github.run_id }}"
}
EOF
cat test-results-windows-x86_64.json
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: vision-test-results-windows-x86_64
path: test-results-windows-x86_64.json
# =============================================================================
# SUMMARY STAGE
# =============================================================================
vision-test-summary:
needs: [test-vision-linux-x86_64, test-vision-windows-x86_64]
if: always()
runs-on: ubuntu-latest
steps:
- name: Download all test results
uses: actions/download-artifact@v4
with:
pattern: vision-test-results-*
path: ./results
merge-multiple: false
- name: Generate summary
run: |
echo "# 👁️ Vision Cross-Platform Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Platform | Vision Compiled | Server Starts | Vision API |" >> $GITHUB_STEP_SUMMARY
echo "|----------|-----------------|---------------|------------|" >> $GITHUB_STEP_SUMMARY
for file in ./results/*/test-results-*.json; do
if [ -f "$file" ]; then
platform=$(jq -r '.platform' "$file")
vision=$(jq -r '.vision_feature_compiled // .vision_enabled // "N/A"' "$file")
server=$(jq -r '.tests.server_starts // "N/A"' "$file")
vision_api=$(jq -r '.tests.vision_api_endpoint // .tests.vision_api_test // "N/A"' "$file")
echo "| $platform | $vision | $server | $vision_api |" >> $GITHUB_STEP_SUMMARY
fi
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Note**: Vision feature is compiled into binaries but the /api/vision HTTP endpoint is not yet implemented." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Run ID: ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
- name: Check for failures
run: |
echo "Vision cross-platform testing completed"
echo "Check artifacts for detailed results"