-
Notifications
You must be signed in to change notification settings - Fork 93
194 lines (162 loc) · 6.85 KB
/
test_agent_sdk.yml
File metadata and controls
194 lines (162 loc) · 6.85 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
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# This workflow tests the Agent SDK functionality with Lemonade server integration
# Tests include: Agent SDK API, conversation handling, and Lemonade integration
# Platform: Windows (with Lemonade server support)
name: Agent SDK Tests (Windows)
on:
push:
branches: ["main"]
paths:
- "src/**"
- "tests/**"
- "setup.py"
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "src/**"
- "tests/**"
- "setup.py"
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-agent-sdk-windows:
name: Test Agent SDK on Windows (Lemonade 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'
install-package: '.[dev]'
- 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
- name: Start Lemonade Server for Integration Tests
timeout-minutes: 15
env:
HUGGINGFACE_ACCESS_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
HF_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
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" -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:8000/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 Agent SDK Integration Tests with Lemonade
shell: cmd
run: |
REM Activate virtual environment
call "%GITHUB_WORKSPACE%\.venv\Scripts\activate.bat"
echo ================================================================
echo AGENT SDK INTEGRATION TESTS WITH LEMONADE SERVER
echo ================================================================
echo Testing real LLM integration with running Lemonade server
echo.
echo ****************************************************************
echo COMPREHENSIVE INTEGRATION TEST SUITE
echo ****************************************************************
echo Starting comprehensive integration tests at %TIME%...
echo.
REM Run the comprehensive integration test suite
set PYTHONIOENCODING=utf-8
python tests\test_agent_sdk.py
set integration_exit=%ERRORLEVEL%
echo.
echo ----------------------------------------------------------------
echo Integration tests completed at %TIME% with exit code: %integration_exit%
if %integration_exit% equ 0 (
echo [SUCCESS] Agent SDK integration tests passed
) else (
echo [FAILURE] Agent SDK integration tests failed with exit code %integration_exit%
echo Full error output displayed above - no truncation
)
echo ----------------------------------------------------------------
if %integration_exit% neq 0 (
exit /b 1
)
- name: Debug Agent SDK Logs on Failure
if: failure()
shell: cmd
run: |
echo === Debugging Agent SDK test 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"
echo === Show recent Python errors ===
if exist "*.log" (
echo Recent log files:
dir *.log
)
echo === Environment information ===
echo VIRTUAL_ENV: %VIRTUAL_ENV%
echo PATH: %PATH%