forked from alibaba/OpenSandbox
-
Notifications
You must be signed in to change notification settings - Fork 1
347 lines (302 loc) · 10.1 KB
/
real-e2e.yml
File metadata and controls
347 lines (302 loc) · 10.1 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
name: Real E2E Tests
permissions:
contents: read
on:
pull_request:
branches: [ main ]
paths:
- 'server/src/**'
- 'components/execd/**'
- 'sdks/code-interpreter/**'
- 'sdks/sandbox/**'
- 'tests/**'
push:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
python-e2e:
name: Python E2E (docker bridge)
runs-on: self-hosted
env:
UV_BIN: /home/admin/.local/bin
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up uv PATH and verify
run: |
echo "${UV_BIN}" >> "$GITHUB_PATH"
export PATH="${UV_BIN}:${PATH}"
uv --version
uv run python --version
- name: Clean up previous E2E resources
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
# Remove root-owned files from previous sandbox runs by mounting parent dir
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
- name: Run tests
run: |
set -e
# Create config file
cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 8080
log_level = "INFO"
api_key = ""
[runtime]
type = "docker"
execd_image = "opensandbox/execd:local"
[egress]
image = "opensandbox/egress:latest"
[docker]
network_mode = "bridge"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF
./scripts/python-e2e.sh
- name: Eval server logs
if: ${{ always() }}
run: cat server/server.log
- name: Upload execd logs
if: always()
uses: actions/upload-artifact@v7
with:
name: execd-log-for-python-e2e
path: /tmp/opensandbox-e2e/logs/
retention-days: 5
- name: Clean up after E2E
if: always()
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
pkill -f "python -m src.main" || true
java-e2e:
name: Java E2E (docker bridge)
runs-on: self-hosted
env:
UV_BIN: /home/admin/.local/bin
JAVA_VERSION: "17.0.14+7"
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up uv PATH and verify
run: |
echo "${UV_BIN}" >> "$GITHUB_PATH"
export PATH="${UV_BIN}:${PATH}"
uv --version
uv run python --version
- name: Set up JDK
run: |
# Adoptium Temurin JDK 17 for Linux x64
JAVA_MAJOR="${JAVA_VERSION%%.*}"
JAVA_URL_VERSION=$(echo "${JAVA_VERSION}" | sed 's/+/%2B/')
JAVA_DIR="/home/admin/.local/jdk-${JAVA_VERSION}"
if [ -x "${JAVA_DIR}/bin/java" ]; then
echo "JDK ${JAVA_VERSION} already cached"
else
echo "Downloading Temurin JDK ${JAVA_VERSION}..."
mkdir -p /home/admin/.local
curl -fsSL "https://api.adoptium.net/v3/binary/version/jdk-${JAVA_URL_VERSION}/linux/x64/jdk/hotspot/normal/eclipse?project=jdk" \
| tar -xzf - -C /home/admin/.local/
fi
echo "${JAVA_DIR}/bin" >> "$GITHUB_PATH"
echo "JAVA_HOME=${JAVA_DIR}" >> "$GITHUB_ENV"
export PATH="${JAVA_DIR}/bin:${PATH}"
java -version
- name: Clean up previous E2E resources
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
- name: Run tests
env:
GRADLE_USER_HOME: ${{ github.workspace }}/.gradle-user-home
run: |
set -e
# Create config file
cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 8080
log_level = "INFO"
api_key = ""
[runtime]
type = "docker"
execd_image = "opensandbox/execd:local"
[egress]
image = "opensandbox/egress:latest"
[docker]
network_mode = "bridge"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF
bash ./scripts/java-e2e.sh
- name: Eval server logs
if: ${{ always() }}
run: cat server/server.log
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v7
with:
name: java-test-report
path: tests/java/build/reports/tests/test/
retention-days: 5
- name: Upload execd logs
if: always()
uses: actions/upload-artifact@v7
with:
name: execd-log-for-java-e2e
path: /tmp/opensandbox-e2e/logs/
retention-days: 5
- name: Clean up after E2E
if: always()
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
pkill -f "python -m src.main" || true
javascript-e2e:
name: JavaScript E2E (docker bridge)
runs-on: self-hosted
env:
UV_BIN: /home/admin/.local/bin
NODE_VERSION: "20.19.0"
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up uv PATH and verify
run: |
echo "${UV_BIN}" >> "$GITHUB_PATH"
export PATH="${UV_BIN}:${PATH}"
uv --version
uv run python --version
- name: Set up Node.js
run: |
NODE_DIR="/home/admin/.local/node-v${NODE_VERSION}-linux-x64"
if [ -x "${NODE_DIR}/bin/node" ]; then
echo "Node.js ${NODE_VERSION} already cached"
else
echo "Downloading Node.js ${NODE_VERSION}..."
mkdir -p /home/admin/.local
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
| tar -xJ -C /home/admin/.local/
fi
echo "${NODE_DIR}/bin" >> "$GITHUB_PATH"
export PATH="${NODE_DIR}/bin:${PATH}"
node --version
npm --version
- name: Clean up previous E2E resources
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
- name: Run tests
run: |
set -e
# Create config file (match other E2E jobs)
cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 8080
log_level = "INFO"
api_key = ""
[runtime]
type = "docker"
execd_image = "opensandbox/execd:local"
[egress]
image = "opensandbox/egress:latest"
[docker]
network_mode = "bridge"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF
bash ./scripts/javascript-e2e.sh
- name: Eval server logs
if: ${{ always() }}
run: cat server/server.log
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v7
with:
name: javascript-test-report
path: tests/javascript/build/test-results/junit.xml
retention-days: 5
- name: Upload execd logs
if: always()
uses: actions/upload-artifact@v7
with:
name: execd-log-for-js-e2e
path: /tmp/opensandbox-e2e/logs/
retention-days: 5
- name: Clean up after E2E
if: always()
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
pkill -f "python -m src.main" || true
csharp-e2e:
name: C# E2E (docker bridge)
runs-on: self-hosted
env:
UV_BIN: /home/admin/.local/bin
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up uv PATH and verify
run: |
echo "${UV_BIN}" >> "$GITHUB_PATH"
export PATH="${UV_BIN}:${PATH}"
uv --version
uv run python --version
- name: Set up .NET SDK
uses: actions/setup-dotnet@v5
env:
DOTNET_INSTALL_DIR: /home/admin/.local/dotnet
with:
dotnet-version: "10.0.x"
- name: Clean up previous E2E resources
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
- name: Run tests
run: |
set -e
cat <<EOF > ~/.sandbox.toml
[server]
host = "127.0.0.1"
port = 8080
log_level = "INFO"
api_key = ""
[runtime]
type = "docker"
execd_image = "opensandbox/execd:local"
[egress]
image = "opensandbox/egress:latest"
[docker]
network_mode = "bridge"
[storage]
allowed_host_paths = ["/tmp/opensandbox-e2e"]
EOF
bash ./scripts/csharp-e2e.sh
- name: Eval server logs
if: ${{ always() }}
run: cat server/server.log
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v7
with:
name: csharp-test-report
path: tests/csharp/build/test-results/
retention-days: 5
- name: Upload execd logs
if: always()
uses: actions/upload-artifact@v7
with:
name: execd-log-for-csharp-e2e
path: /tmp/opensandbox-e2e/logs/
retention-days: 5
- name: Clean up after E2E
if: always()
run: |
docker ps -aq --filter "label=opensandbox" | xargs -r docker rm -f || true
docker run --rm -v /tmp:/host_tmp alpine rm -rf /host_tmp/opensandbox-e2e || true
pkill -f "python -m src.main" || true