Skip to content

Commit 6c86abd

Browse files
authored
Merge pull request #5 from Pangjiping/feat/server-lint
feat(workflow): add server smoke test workflow
2 parents 5d80858 + 90281e7 commit 6c86abd

2 files changed

Lines changed: 89 additions & 1 deletion

File tree

.github/workflows/server-test.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Server Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- 'server/**'
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.10'
20+
21+
- name: Install uv
22+
run: |
23+
pip install uv
24+
25+
- name: Run tests
26+
run: |
27+
cd server
28+
uv sync --all-groups
29+
uv run ruff check
30+
uv run pytest
31+
32+
docker-smoke:
33+
strategy:
34+
matrix:
35+
network: [host, bridge]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Python
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: '3.10'
45+
46+
- name: Install uv
47+
run: |
48+
pip install uv
49+
50+
- name: Set up Docker
51+
run: |
52+
docker --version
53+
54+
- name: Run smoke test
55+
run: |
56+
set -e
57+
cd server
58+
uv sync --all-groups
59+
60+
# Create config file
61+
cat <<EOF > ~/.sandbox.toml
62+
[server]
63+
host = "127.0.0.1"
64+
port = 32888
65+
log_level = "INFO"
66+
api_key = ""
67+
[runtime]
68+
type = "docker"
69+
execd_image = "opensandbox/execd:latest"
70+
[docker]
71+
network_mode = "${{ matrix.network }}"
72+
EOF
73+
74+
# Start server in background
75+
uv run python -m src.main > app.log 2>&1 &
76+
77+
# Wait for server to start
78+
sleep 10
79+
80+
# Show server logs for debugging
81+
cat app.log
82+
83+
# Run smoke test
84+
chmod +x tests/smoke.sh
85+
./tests/smoke.sh
86+
87+
# Show final logs
88+
cat app.log

server/tests/smoke.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,4 @@ echo "Sandbox state: ${state_short}"
259259
step "Wait for sandbox ${SANDBOX_ID} to auto-expire (expect 404)"
260260
wait_for_expired "${SANDBOX_ID}"
261261

262-
step "Lifecycle API smoke test completed successfully"
262+
step "server Lifecycle API smoke test completed successfully"

0 commit comments

Comments
 (0)