-
Notifications
You must be signed in to change notification settings - Fork 783
106 lines (90 loc) · 2.23 KB
/
server-test.yml
File metadata and controls
106 lines (90 loc) · 2.23 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
name: Server Tests
on:
pull_request:
branches: [ main ]
paths:
- 'server/opensandbox_server/**'
- 'server/tests/**'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
run: |
pip install uv
- name: Run tests
run: |
cd server
uv sync --all-groups
uv run ruff check
uv run pytest
docker-smoke:
strategy:
matrix:
network: [host, bridge]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
run: |
pip install uv
- name: Set up Docker
run: |
docker --version
- name: Run smoke test
run: |
set -e
cd server
uv sync --all-groups
# Create config file
cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 32888
api_key = ""
[log]
level = "INFO"
[runtime]
type = "docker"
execd_image = "opensandbox/execd:latest"
[egress]
image = "opensandbox/egress:latest"
[docker]
network_mode = "${{ matrix.network }}"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF
# Start server in background
uv run python -m opensandbox_server.main > app.log 2>&1 &
# Wait for server to start
sleep 10
# Run smoke test
chmod +x tests/smoke.sh
./tests/smoke.sh
- name: Show logs
if: always()
run: |
cat server/app.log