Skip to content

Commit 6b02dd3

Browse files
committed
ci: add sanity checking
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent d34a31b commit 6b02dd3

File tree

1 file changed

+226
-0
lines changed

1 file changed

+226
-0
lines changed

.github/workflows/smoke.yml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: Smoke
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
schedule:
9+
- cron: '0 0 * * *' # Run daily at midnight UTC
10+
11+
jobs:
12+
smoke:
13+
name: ${{ matrix.os }} / Node ${{ matrix.node }} / Python ${{ matrix.python }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
node: [20, 22]
20+
python: [3.11, 3.12]
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node }}
30+
31+
- name: Setup Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: ${{ matrix.python }}
35+
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v1
38+
with:
39+
version: "latest"
40+
41+
- name: Install Node.js dependencies (root)
42+
run: npm install
43+
44+
- name: Install Node.js dependencies (agent)
45+
run: |
46+
cd agent
47+
npm install
48+
49+
- name: Install Python dependencies (agent)
50+
run: |
51+
cd agent
52+
uv sync
53+
54+
- name: Build frontend
55+
run: npm run build
56+
57+
- name: Test frontend startup (Linux/macOS)
58+
if: runner.os != 'Windows'
59+
run: |
60+
# Start the Next.js frontend in background
61+
npm start &
62+
FRONTEND_PID=$!
63+
64+
# Wait for frontend to start (max 30 seconds)
65+
timeout=30
66+
elapsed=0
67+
started=false
68+
69+
while [ $elapsed -lt $timeout ] && [ "$started" = false ]; do
70+
if curl -s http://localhost:3000 > /dev/null 2>&1; then
71+
started=true
72+
echo "✅ Frontend started successfully"
73+
else
74+
sleep 1
75+
elapsed=$((elapsed + 1))
76+
fi
77+
done
78+
79+
# Clean up background process
80+
kill $FRONTEND_PID 2>/dev/null || true
81+
82+
if [ "$started" = false ]; then
83+
echo "❌ Frontend failed to start within 30 seconds"
84+
exit 1
85+
fi
86+
shell: bash
87+
88+
- name: Test frontend startup (Windows)
89+
if: runner.os == 'Windows'
90+
run: |
91+
# Start the Next.js frontend in background
92+
npm start &
93+
94+
# Wait for frontend to start (max 30 seconds)
95+
$timeout = 30
96+
$elapsed = 0
97+
$started = $false
98+
99+
while ($elapsed -lt $timeout -and -not $started) {
100+
try {
101+
$response = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 1 -ErrorAction SilentlyContinue
102+
if ($response.StatusCode -eq 200) {
103+
$started = $true
104+
Write-Host "✅ Frontend started successfully"
105+
}
106+
} catch {
107+
Start-Sleep -Seconds 1
108+
$elapsed++
109+
}
110+
}
111+
112+
if (-not $started) {
113+
Write-Host "❌ Frontend failed to start within 30 seconds"
114+
exit 1
115+
}
116+
shell: pwsh
117+
118+
- name: Test agent startup (Linux/macOS)
119+
if: runner.os != 'Windows'
120+
run: |
121+
# Start the LlamaIndex agent in background
122+
cd agent
123+
uv run dev &
124+
AGENT_PID=$!
125+
126+
# Wait for agent to start (max 30 seconds)
127+
timeout=30
128+
elapsed=0
129+
started=false
130+
131+
while [ $elapsed -lt $timeout ] && [ "$started" = false ]; do
132+
if curl -s http://localhost:9000/chat > /dev/null 2>&1; then
133+
started=true
134+
echo "✅ Agent started successfully"
135+
else
136+
sleep 1
137+
elapsed=$((elapsed + 1))
138+
fi
139+
done
140+
141+
# Clean up background process
142+
kill $AGENT_PID 2>/dev/null || true
143+
144+
if [ "$started" = false ]; then
145+
echo "❌ Agent failed to start within 30 seconds"
146+
exit 1
147+
fi
148+
shell: bash
149+
150+
- name: Test agent startup (Windows)
151+
if: runner.os == 'Windows'
152+
run: |
153+
# Start the LlamaIndex agent in background
154+
cd agent
155+
uv run dev &
156+
157+
# Wait for agent to start (max 30 seconds)
158+
$timeout = 30
159+
$elapsed = 0
160+
$started = $false
161+
162+
while ($elapsed -lt $timeout -and -not $started) {
163+
try {
164+
$response = Invoke-WebRequest -Uri "http://localhost:9000/chat" -TimeoutSec 1 -ErrorAction SilentlyContinue
165+
if ($response.StatusCode -eq 200) {
166+
$started = $true
167+
Write-Host "✅ Agent started successfully"
168+
}
169+
} catch {
170+
Start-Sleep -Seconds 1
171+
$elapsed++
172+
}
173+
}
174+
175+
if (-not $started) {
176+
Write-Host "❌ Agent failed to start within 30 seconds"
177+
exit 1
178+
}
179+
shell: pwsh
180+
181+
- name: Test agent functionality
182+
run: |
183+
cd agent
184+
# Test that the agent can be imported and basic functionality works
185+
python -c "
186+
from agent.agent import agentic_chat_router
187+
from agent.server import app
188+
print('✅ Agent imports successfully')
189+
190+
# Check that the router has the expected tools
191+
tools = agentic_chat_router.routes
192+
print(f'✅ Agent has {len(tools)} routes configured')
193+
"
194+
env:
195+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
196+
197+
- name: Run linting
198+
run: npm run lint
199+
200+
notify-slack:
201+
name: Notify Slack on Failure
202+
runs-on: ubuntu-latest
203+
needs: smoke
204+
if: |
205+
failure() &&
206+
github.event_name == 'schedule'
207+
steps:
208+
- name: Notify Slack
209+
uses: slackapi/slack-github-action@v1.24.0
210+
with:
211+
channel-id: 'general'
212+
payload: |
213+
{
214+
"text": ":warning: *Smoke test failed on `with-llamaindex`* :warning:",
215+
"blocks": [
216+
{
217+
"type": "section",
218+
"text": {
219+
"type": "mrkdwn",
220+
"text": ":warning: *Smoke test failed on `with-llamaindex`* :warning:\n\n*Repository:* ${{ github.repository }}\n*Workflow:* ${{ github.workflow }}\n*Run ID:* ${{ github.run_id }}\n*Commit:* ${{ github.sha }}\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run details>"
221+
}
222+
}
223+
]
224+
}
225+
env:
226+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)