-
Notifications
You must be signed in to change notification settings - Fork 479
193 lines (165 loc) · 5.63 KB
/
Copy pathmcp-smoke-test.yml
File metadata and controls
193 lines (165 loc) · 5.63 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
name: MCP Smoke Test
# Smoke-tests all 5 MCP tools (lemonade_list_models, lemonade_chat,
# lemonade_transcribe_audio, lemonade_generate_image, lemonade_omni) via two
# independent build paths: a native CMake build and a Docker image build.
# Either job failing fails the workflow.
on:
pull_request:
paths:
- "src/cpp/server/mcp_server.cpp"
- "src/cpp/include/lemon/mcp_server.h"
- "src/cpp/server/server.cpp"
- "src/cpp/server/router.cpp"
- "src/cpp/server/model_manager.cpp"
- "src/cpp/resources/server_models.json"
- "src/cpp/resources/backend_versions.json"
- "Dockerfile"
- ".dockerignore"
- "CMakeLists.txt"
- "CMakePresets.json"
- "setup.sh"
- "test/server_mcp_smoke.py"
- "test/server_mcp.py"
- ".github/workflows/mcp-smoke-test.yml"
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'pull_request' && 'pr' || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# ========================================================================
# CMake path: build lemond natively, start it, hit /mcp
# ========================================================================
cmake-smoke-test:
name: CMake build + MCP smoke test
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
libssl-dev \
libcurl4-openssl-dev \
pkg-config \
libdrm-dev
- name: Cache FetchContent dependencies
uses: actions/cache@v5
with:
path: build/_deps
key: mcp-smoke-fetchcontent-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
mcp-smoke-fetchcontent-
- name: Configure (CMake, web-app disabled)
run: |
cmake --preset default -DBUILD_WEB_APP=OFF
- name: Build lemond
run: |
cmake --build --preset default --target lemond
- name: Verify lemond binary
run: |
test -x build/lemond
./build/lemond --version
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Python test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install requests
- name: Start lemond in background
run: |
mkdir -p server-logs-cmake
mkdir -p ci-cache-cmake
nohup ./build/lemond ci-cache-cmake \
--host 127.0.0.1 --port 13305 \
> server-logs-cmake/lemond.stdout.log \
2> server-logs-cmake/lemond.stderr.log &
echo "$!" > lemond.pid
echo "Started lemond PID $(cat lemond.pid)"
- name: Run MCP smoke tests against CMake build
run: |
python test/server_mcp_smoke.py --host 127.0.0.1 --port 13305
- name: Shut down lemond
if: always()
run: |
curl -s -X POST http://127.0.0.1:13305/internal/shutdown || true
sleep 2
if [ -f lemond.pid ]; then
kill "$(cat lemond.pid)" 2>/dev/null || true
fi
- name: Upload server logs
if: always()
uses: actions/upload-artifact@v7
with:
name: cmake-server-logs
path: server-logs-cmake/
retention-days: 7
if-no-files-found: ignore
# ========================================================================
# Docker path: build the image, run the container, hit /mcp
# ========================================================================
docker-smoke-test:
name: Docker build + MCP smoke test
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
tags: lemonade-server:mcp-smoke
push: false
load: true
cache-from: type=gha,scope=mcp-smoke
cache-to: type=gha,mode=max,scope=mcp-smoke
- name: Run container
run: |
docker run -d \
--name lemonade-mcp-smoke \
-p 13305:13305 \
lemonade-server:mcp-smoke
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Python test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install requests
- name: Run MCP smoke tests against Docker container
run: |
python test/server_mcp_smoke.py --host 127.0.0.1 --port 13305
- name: Capture container logs
if: always()
run: |
mkdir -p server-logs-docker
docker logs lemonade-mcp-smoke \
> server-logs-docker/lemond.stdout.log \
2> server-logs-docker/lemond.stderr.log || true
- name: Stop container
if: always()
run: |
docker rm -f lemonade-mcp-smoke || true
- name: Upload container logs
if: always()
uses: actions/upload-artifact@v7
with:
name: docker-server-logs
path: server-logs-docker/
retention-days: 7
if-no-files-found: ignore