Skip to content

Commit d6acab8

Browse files
committed
ci: add Docker smoke test for health and version endpoints
1 parent 48c6273 commit d6acab8

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,72 @@ jobs:
171171
env:
172172
ELECTRON_DISABLE_SANDBOX: 1
173173

174+
docker-smoke-test:
175+
name: Docker Smoke Test
176+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
177+
if: github.event.inputs.test_filter == ''
178+
steps:
179+
- name: Checkout code
180+
uses: actions/checkout@v4
181+
with:
182+
fetch-depth: 0 # Required for git describe to find tags
183+
184+
- name: Set up Docker Buildx
185+
uses: docker/setup-buildx-action@v3
186+
187+
- name: Build Docker image
188+
uses: docker/build-push-action@v6
189+
with:
190+
context: .
191+
load: true
192+
tags: mux-server:test
193+
cache-from: type=gha
194+
cache-to: type=gha,mode=max
195+
196+
- name: Start container
197+
run: |
198+
docker run -d --name mux-test -p 3000:3000 mux-server:test
199+
# Wait for server to be ready
200+
for i in {1..30}; do
201+
if curl -sf http://localhost:3000/health; then
202+
echo "Server is ready"
203+
break
204+
fi
205+
echo "Waiting for server... ($i/30)"
206+
sleep 1
207+
done
208+
209+
- name: Health check
210+
run: |
211+
response=$(curl -sf http://localhost:3000/health)
212+
echo "Health response: $response"
213+
if ! echo "$response" | grep -q '"status":"ok"'; then
214+
echo "Health check failed"
215+
exit 1
216+
fi
217+
218+
- name: Version check
219+
run: |
220+
response=$(curl -sf http://localhost:3000/version)
221+
echo "Version response: $response"
222+
# Verify response contains expected fields
223+
if ! echo "$response" | grep -q '"mode":"server"'; then
224+
echo "Version check failed: missing mode=server"
225+
exit 1
226+
fi
227+
if ! echo "$response" | grep -q '"version"'; then
228+
echo "Version check failed: missing version field"
229+
exit 1
230+
fi
231+
232+
- name: Show container logs on failure
233+
if: failure()
234+
run: docker logs mux-test
235+
236+
- name: Cleanup
237+
if: always()
238+
run: docker rm -f mux-test || true
239+
174240
check-codex-comments:
175241
name: Check Codex Comments
176242
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}

0 commit comments

Comments
 (0)