-
Notifications
You must be signed in to change notification settings - Fork 123
419 lines (365 loc) · 17.8 KB
/
Copy pathtest_gaia_cli_windows.yml
File metadata and controls
419 lines (365 loc) · 17.8 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
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# This workflow tests the GAIA CLI on Windows with full Lemonade server integration
# Tests include: CLI functionality, Lemonade integration, audio features, and core commands
# Platform: Windows (with Lemonade server and NPU support)
name: GAIA CLI Tests (Windows)
on:
workflow_call:
push:
branches: ["main"]
paths:
- "src/**"
- "tests/**"
- "setup.py"
- "pyproject.toml"
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "src/**"
- "tests/**"
- "setup.py"
- "pyproject.toml"
merge_group:
workflow_dispatch:
# Cancel in-progress runs when a new run is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test-gaia-cli-windows:
name: Test GAIA CLI on Windows (Full Integration)
runs-on: ${{ contains(github.event.pull_request.labels.*.name, 'stx-test') && 'stx-test' || 'stx' }}
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
steps:
- uses: actions/checkout@v6
- name: Setup Python Environment
uses: ./.github/actions/setup-venv
with:
python-version: '3.12'
# Note: 'blender' excluded as bpy requires Blender runtime
install-package: '.[dev,talk,rag,mcp,api]'
extra-index-url: 'https://download.pytorch.org/whl/cpu'
- name: Install Lemonade Server
uses: ./.github/actions/install-lemonade
- name: Verify GAIA Installation
run: |
Write-Host "Verifying GAIA installation..."
$gaiaPath = Get-Command gaia -ErrorAction SilentlyContinue
if (-not $gaiaPath) {
Write-Host "Error: gaia not installed correctly"
Write-Host "Current PATH: $env:Path"
exit 1
}
Write-Host "Found gaia at: $($gaiaPath.Source)"
python --version
python -m pip check
- uses: FedericoCarboni/setup-ffmpeg@v3
id: setup-ffmpeg
- name: Start Lemonade Server and Run Tests
timeout-minutes: 20
env:
HUGGINGFACE_ACCESS_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
HF_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
PYTHONUTF8: 1
run: |
Write-Host "Verify Python environment"
python -c "import sys; print(sys.executable)"
Write-Host "Find gaia executable location"
$gaiaPath = Get-Command gaia -ErrorAction SilentlyContinue
if (-not $gaiaPath) {
Write-Host "Error: Cannot find gaia executable in PATH"
Write-Host "Current PATH: $env:Path"
exit 1
}
Write-Host "Found gaia at: $($gaiaPath.Source)"
# Start the server in the background as a process (not PowerShell job)
Write-Host "Starting lemonade-server in background..."
# Start the server as a background process
$serverProcess = Start-Process -FilePath "lemonade-server" -ArgumentList "serve", "--no-tray", "--port", "13305" -PassThru -WindowStyle Hidden
Write-Host "Started lemonade-server process with ID: $($serverProcess.Id)"
# Wait for server to start up
Write-Host "Waiting for server to start up..."
$maxWaitTime = 30 # seconds
$waitTime = 0
$serverReady = $false
while ($waitTime -lt $maxWaitTime -and -not $serverReady) {
Start-Sleep -Seconds 2
$waitTime += 2
try {
$response = Invoke-RestMethod -Uri "http://localhost:13305/api/v1/health" -Method GET -TimeoutSec 5
Write-Host "Server is ready and responding to health checks"
$serverReady = $true
} catch {
Write-Host "Server not ready yet (waited $waitTime seconds)..."
}
}
if (-not $serverReady) {
Write-Host "Server failed to start within $maxWaitTime seconds"
try {
if (-not $serverProcess.HasExited) {
$serverProcess.Kill()
}
} catch {
Write-Host "Error stopping server process: $_"
}
throw "Failed to start lemonade-server for tests"
}
Write-Host "Lemonade server started successfully"
# Pull the model now that server is running
Write-Host "Pulling Llama-3.2-3B-Instruct-Hybrid model..."
lemonade-server pull Llama-3.2-3B-Instruct-Hybrid
- name: Run Unit Tests (Direct CMD - Full Error Visibility)
shell: cmd
env:
PYTHONUTF8: 1
run: |
REM Activate virtual environment
call "%GITHUB_WORKSPACE%\.venv\Scripts\activate.bat"
echo ================================================================
echo GAIA UNIT TESTS - FULL ERROR LOGGING
echo ================================================================
echo Virtual Environment: %VIRTUAL_ENV%
echo Python Version:
python --version
echo Working Directory: %CD%
echo.
REM Initialize test tracking
set test_llm_exit=0
set test_asr_exit=0
set test_tts_exit=0
REM ================================================================
REM TEST_LLM.PY
REM ================================================================
echo ****************************************************************
echo TEST_LLM.PY
echo ****************************************************************
echo Starting test_llm.py at %TIME%...
echo.
python tests\unit\test_llm.py
set test_llm_exit=%ERRORLEVEL%
echo.
echo ----------------------------------------------------------------
echo test_llm.py completed at %TIME% with exit code: %test_llm_exit%
if %test_llm_exit% equ 0 (
echo [SUCCESS] test_llm.py passed
) else (
echo [FAILURE] test_llm.py failed with exit code %test_llm_exit%
echo Full error output displayed above - no truncation
)
echo ----------------------------------------------------------------
echo.
REM ================================================================
REM TEST_ASR.PY
REM ================================================================
echo ****************************************************************
echo TEST_ASR.PY
echo ****************************************************************
echo Starting test_asr.py at %TIME%...
echo.
python tests\unit\test_asr.py
set test_asr_exit=%ERRORLEVEL%
echo.
echo ----------------------------------------------------------------
echo test_asr.py completed at %TIME% with exit code: %test_asr_exit%
if %test_asr_exit% equ 0 (
echo [SUCCESS] test_asr.py passed
) else (
echo [FAILURE] test_asr.py failed with exit code %test_asr_exit%
echo Full error output displayed above - no truncation
)
echo ----------------------------------------------------------------
echo.
REM ================================================================
REM TEST_TTS.PY
REM ================================================================
echo ****************************************************************
echo TEST_TTS.PY
echo ****************************************************************
echo Starting test_tts.py at %TIME%...
echo.
python tests\unit\test_tts.py
set test_tts_exit=%ERRORLEVEL%
echo.
echo ----------------------------------------------------------------
echo test_tts.py completed at %TIME% with exit code: %test_tts_exit%
if %test_tts_exit% equ 0 (
echo [SUCCESS] test_tts.py passed
) else (
echo [FAILURE] test_tts.py failed with exit code %test_tts_exit%
echo Full error output displayed above - no truncation
)
echo ----------------------------------------------------------------
echo.
REM ================================================================
REM FINAL SUMMARY
REM ================================================================
echo ================================================================
echo FINAL TEST SUMMARY
echo ================================================================
echo test_llm.py: exit code %test_llm_exit%
echo test_asr.py: exit code %test_asr_exit%
echo test_tts.py: exit code %test_tts_exit%
echo ================================================================
REM Calculate total failures
set /a total_failures=%test_llm_exit%+%test_asr_exit%+%test_tts_exit%
if %total_failures% equ 0 (
echo [OVERALL SUCCESS] All tests passed successfully
echo ================================================================
exit /b 0
) else (
echo [OVERALL FAILURE] One or more tests failed
echo ================================================================
echo FAILED TESTS:
if %test_llm_exit% neq 0 echo - test_llm.py ^(exit code %test_llm_exit%^)
if %test_asr_exit% neq 0 echo - test_asr.py ^(exit code %test_asr_exit%^)
if %test_tts_exit% neq 0 echo - test_tts.py ^(exit code %test_tts_exit%^)
echo ================================================================
echo IMPORTANT: All error messages are displayed in full above
echo No PowerShell wrapping or truncation - raw Python output preserved
echo ================================================================
exit /b 1
)
- name: Run Summarizer Integration Tests (CMD - CLI Testing)
shell: cmd
env:
PYTHONUTF8: 1
run: |
REM Activate virtual environment
call "%GITHUB_WORKSPACE%\.venv\Scripts\activate.bat"
echo ================================================================
echo GAIA SUMMARIZER CLI INTEGRATION TESTS
echo ================================================================
echo Virtual Environment: %VIRTUAL_ENV%
echo Python Version:
python --version
echo Working Directory: %CD%
echo.
REM Initialize test tracking
set summarizer_exit=0
REM ================================================================
REM TEST_SUMMARIZER.PY - CLI INTEGRATION TESTS
REM ================================================================
echo ****************************************************************
echo SUMMARIZER CLI INTEGRATION TESTS
echo ****************************************************************
echo Starting test_summarizer.py at %TIME%...
echo Testing complete CLI workflow: gaia summarize command
echo.
python -m pytest tests\test_summarizer.py -vs --tb=short
set summarizer_exit=%ERRORLEVEL%
echo.
echo ----------------------------------------------------------------
echo test_summarizer.py completed at %TIME% with exit code: %summarizer_exit%
if %summarizer_exit% equ 0 (
echo [SUCCESS] Summarizer CLI integration tests passed
) else (
echo [FAILURE] Summarizer CLI integration tests failed with exit code %summarizer_exit%
echo Full error output displayed above - no truncation
)
echo ----------------------------------------------------------------
echo.
REM ================================================================
REM SUMMARIZER TEST SUMMARY
REM ================================================================
echo ================================================================
echo SUMMARIZER TEST SUMMARY
echo ================================================================
echo test_summarizer.py: exit code %summarizer_exit%
echo ================================================================
if %summarizer_exit% neq 0 (
echo [FAILURE] Summarizer CLI integration tests failed
echo ================================================================
echo FAILED TEST:
echo - test_summarizer.py ^(exit code %summarizer_exit%^)
echo ================================================================
echo IMPORTANT: All error messages are displayed in full above
echo No PowerShell wrapping or truncation - raw Python output preserved
echo ================================================================
exit /b 1
) else (
echo [SUCCESS] Summarizer CLI integration tests passed successfully
echo ================================================================
)
- name: Run Lemonade Client Integration Tests (CMD)
shell: cmd
env:
PYTHONUTF8: 1
GAIA_TEST_MODEL: Llama-3.2-3B-Instruct-Hybrid
run: |
REM Activate virtual environment
call "%GITHUB_WORKSPACE%\.venv\Scripts\activate.bat"
echo ================================================================
echo LEMONADE CLIENT INTEGRATION TESTS
echo ================================================================
echo Virtual Environment: %VIRTUAL_ENV%
echo Python Version:
python --version
echo Test Model: %GAIA_TEST_MODEL%
echo Working Directory: %CD%
echo.
REM Initialize test tracking
set lemonade_exit=0
REM ================================================================
REM TEST_LEMONADE_CLIENT.PY - INTEGRATION TESTS ONLY
REM ================================================================
echo ****************************************************************
echo LEMONADE CLIENT INTEGRATION TESTS
echo ****************************************************************
echo Starting test_lemonade_client.py integration tests at %TIME%...
echo.
REM Run only integration tests (skip mock tests which don't need server)
python -m pytest tests\test_lemonade_client.py -vs --tb=short -k "Integration"
set lemonade_exit=%ERRORLEVEL%
echo.
echo ----------------------------------------------------------------
echo test_lemonade_client.py completed at %TIME% with exit code: %lemonade_exit%
if %lemonade_exit% equ 0 (
echo [SUCCESS] Lemonade client integration tests passed
) else (
echo [FAILURE] Lemonade client integration tests failed with exit code %lemonade_exit%
echo Full error output displayed above - no truncation
)
echo ----------------------------------------------------------------
echo.
REM ================================================================
REM LEMONADE CLIENT TEST SUMMARY
REM ================================================================
echo ================================================================
echo LEMONADE CLIENT TEST SUMMARY
echo ================================================================
echo test_lemonade_client.py: exit code %lemonade_exit%
echo ================================================================
if %lemonade_exit% neq 0 (
echo [FAILURE] Lemonade client integration tests failed
echo ================================================================
echo FAILED TEST:
echo - test_lemonade_client.py ^(exit code %lemonade_exit%^)
echo ================================================================
echo IMPORTANT: All error messages are displayed in full above
echo No PowerShell wrapping or truncation - raw Python output preserved
echo ================================================================
exit /b 1
) else (
echo [SUCCESS] Lemonade client integration tests passed successfully
echo ================================================================
)
- name: Debug GAIA Logs on Failure
if: failure()
shell: cmd
run: |
echo === Debugging GAIA failure ===
echo === Check for GAIA log files ===
if exist "gaia.cli.log" (
echo Found gaia.cli.log:
type gaia.cli.log
) else (
echo No gaia.cli.log found
)
echo === Check running processes ===
tasklist | findstr /i "python gaia lemonade-server"
echo === Check ports in use ===
netstat -an | findstr ":8000 :8001"