Initial commit: Gitea CI jobs in gVisor with sandboxed Docker
This commit is contained in:
commit
6c14f5d76d
17 files changed
+1084
No files matched your search
@@ -0,0 +1,58 @@
|
||||
name: gvisor-resource-test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
resource-test:
|
||||
runs-on: gvisor
|
||||
steps:
|
||||
- name: Environment
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
grep -qi gvisor /proc/version
|
||||
echo "kernel: $(uname -r)"
|
||||
echo "nproc: $(nproc)"
|
||||
free -m || true
|
||||
df -h .
|
||||
|
||||
- name: Disk I/O (2 GiB write + read)
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
echo "Writing 2 GiB to the job workspace..."
|
||||
sync
|
||||
dd if=/dev/zero of=./gvisor-disk-test bs=1M count=2048 2>&1 | tail -1
|
||||
sync
|
||||
echo "Reading 2 GiB back..."
|
||||
dd if=./gvisor-disk-test of=/dev/null bs=1M 2>&1 | tail -1
|
||||
ls -lh ./gvisor-disk-test
|
||||
rm -f ./gvisor-disk-test
|
||||
|
||||
- name: Memory allocation (2 GiB)
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
start=$(date +%s)
|
||||
# BusyBox awk: create 2048 one-MiB strings and touch them so the
|
||||
# allocation really happens inside the gVisor sandbox.
|
||||
awk 'BEGIN {
|
||||
for (i = 0; i < 2048; i++) a[i] = sprintf("%01048576s", "");
|
||||
# Touch every string so the pages really stay resident.
|
||||
for (i = 0; i < 2048; i++) if (length(a[i]) != 1048576) exit 1;
|
||||
printf "allocated=%d MiB\n", 2048;
|
||||
}'
|
||||
end=$(date +%s)
|
||||
echo "elapsed_s=$((end - start))"
|
||||
|
||||
- name: CPU scheduling (1 core, then 4 parallel workers)
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
echo "Single-core awk integer loop:"
|
||||
time awk 'BEGIN { for (i = 0; i < 10000000; i++) x += i; print x }'
|
||||
echo "Four parallel awk loops:"
|
||||
time sh -c 'for i in 1 2 3 4; do awk "BEGIN { for (i = 0; i < 5000000; i++) x += i; print x }" & done; wait'
|
||||
Reference in new issue
Block a user