add io-related benchmark #130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Test | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- release/** | |
- dev | |
pull_request: null | |
workflow_dispatch: | |
jobs: | |
golangci-lint: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.x | |
- run: sudo apt-get update | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: v1.55.2 | |
args: --verbose | |
create-lxc-image: | |
name: create-lxc-image | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-base-${{ hashFiles('go.sum', 'tests/setup_test.sh', 'tests/sync_lxc.sh') }} | |
path: /tmp/test-image.tar.zst | |
lookup-only: true | |
- name: setup lxd | |
id: s1 | |
if: steps.cache-restore.outputs.cache-hit != 'true' | |
run: ./tests/setup_lxd.sh | |
- name: launch lxc container | |
id: s2 | |
if: steps.s1.conclusion == 'success' | |
run: ./tests/launch_test_lxc.sh | |
- name: install dependencies and build | |
id: s3 | |
if: steps.s2.conclusion == 'success' | |
run: sudo lxc exec test -- sudo --login --user ubuntu /host/tests/setup_test.sh | |
- name: export image | |
id: s4 | |
if: steps.s3.conclusion == 'success' | |
run: ./tests/export_lxc_image.sh test | |
- uses: actions/cache/save@v4 | |
id: s5 | |
if: steps.s4.conclusion == 'success' | |
with: | |
key: lxc-image-base-${{ hashFiles('go.sum', 'tests/setup_test.sh', 'tests/sync_lxc.sh') }} | |
path: /tmp/test-image.tar.zst | |
sync: | |
runs-on: ubuntu-22.04 | |
needs: create-lxc-image | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup lxd | |
run: ./tests/setup_lxd.sh | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-base-${{ hashFiles('go.sum', 'tests/setup_test.sh', 'tests/sync_lxc.sh') }} | |
path: /tmp/test-image.tar.zst | |
fail-on-cache-miss: true | |
- name: load lxc image | |
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export | |
- name: launch lxc container | |
run: ./tests/launch_test_lxc.sh test-export | |
- name: run test | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && /home/ubuntu/d4c/tests/sync_lxc.sh" | |
# some source codes may be updated. re-export new image. | |
- name: export image | |
run: sudo lxc image alias delete test-export && rm -f /tmp/test-image.tar.zst && ./tests/export_lxc_image.sh test | |
- uses: actions/cache/save@v4 | |
with: | |
key: lxc-image-${{ github.sha }} | |
path: /tmp/test-image.tar.zst | |
benchmark: | |
runs-on: ubuntu-22.04 | |
needs: sync | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
script: ["apache", "mysql", "nginx", "postgres", "redis"] | |
thread: ["1", "4"] | |
sched: ["none", "size-ordered"] | |
comp: ["bzip2", "zstd"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup lxd | |
run: ./tests/setup_lxd.sh | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-${{ github.sha }} | |
path: /tmp/test-image.tar.zst | |
fail-on-cache-miss: true | |
- name: load lxc image | |
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export | |
- name: launch lxc container | |
run: ./tests/launch_test_lxc.sh test-export | |
- name: run benchmark (${{ matrix.script }}) | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && RUNNER=GHA sudo -E /home/ubuntu/d4c/tests/bench_single.sh benchmark benchmark/images ${{ matrix.script }} ${{ matrix.thread }} ${{ matrix.sched }} ${{ matrix.comp }}" | |
benchmark-cdimg: | |
runs-on: ubuntu-22.04 | |
needs: sync | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
script: ["apache", "mysql", "nginx", "postgres", "redis"] | |
thread: ["1", "4"] | |
sched: ["none", "size-ordered"] | |
comp: ["bzip2", "zstd"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup lxd | |
run: ./tests/setup_lxd.sh | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-${{ github.sha }} | |
path: /tmp/test-image.tar.zst | |
fail-on-cache-miss: true | |
- name: load lxc image | |
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export | |
- name: launch lxc container | |
run: ./tests/launch_test_lxc.sh test-export | |
- name: run benchmark (${{ matrix.script }} with ${{ matrix.thread}} threads) | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && sudo /home/ubuntu/d4c/tests/bench_cdimg_lxc.sh ${{ matrix.script }} ${{ matrix.thread }} ${{ matrix.sched }} ${{ matrix.comp }}" | |
test-merge: | |
runs-on: ubuntu-22.04 | |
needs: sync | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup lxd | |
run: ./tests/setup_lxd.sh | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-${{ github.sha }} | |
path: /tmp/test-image.tar.zst | |
fail-on-cache-miss: true | |
- name: load lxc image | |
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export | |
- name: launch lxc container | |
run: ./tests/launch_test_lxc.sh test-export | |
- name: run test_merge.sh | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && sudo /home/ubuntu/d4c/tests/test_merge.sh" | |
test-convert: | |
runs-on: ubuntu-22.04 | |
needs: sync | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup lxd | |
run: ./tests/setup_lxd.sh | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-${{ github.sha }} | |
path: /tmp/test-image.tar.zst | |
fail-on-cache-miss: true | |
- name: load lxc image | |
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export | |
- name: launch lxc container | |
run: ./tests/launch_test_lxc.sh test-export | |
- name: run test_merge.sh | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && sudo /home/ubuntu/d4c/tests/test_convert.sh" | |
benchmark-all: | |
runs-on: ubuntu-22.04 | |
needs: sync | |
timeout-minutes: 100 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup lxd | |
run: ./tests/setup_lxd.sh | |
- uses: actions/cache/restore@v4 | |
id: cache-restore | |
with: | |
key: lxc-image-${{ github.sha }} | |
path: /tmp/test-image.tar.zst | |
fail-on-cache-miss: true | |
# thanks to https://github.com/NobuoTsukamoto/my_actions_test/blob/main/.github/workflows/test_contains.ym | |
- name: Check space before cleanup | |
run: | | |
sudo rm -rf "/opt/*" || true | |
sudo rm -rf "/usr/share/dotnet" || true | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true | |
sudo rm -rf "/usr/local/lib/android" || true | |
sudo rm -rf "/usr/local/share/boost" || true | |
sudo rm -rf "/usr/lib/jvm" || true | |
sudo rm -rf "/usr/share/swift" || true | |
sudo rm -rf "/usr/local/julia*" || true | |
sudo rm -rf "/usr/share/kotlinc" || true | |
sudo rm -rf "/usr/local/share/edge_driver" || true | |
sudo rm -rf "/usr/local/share/chromedriver-linux64" || true | |
sudo rm -rf "/usr/local/share/gecko_driver" || true | |
sudo rm -rf "/usr/share/miniconda" || true | |
sudo rm -rf "/usr/local/share/phantomjs*" || true | |
sudo rm -rf "/usr/share/sbt" || true | |
sudo rm -rf "/usr/local/sqlpackage" || true | |
sudo rm -rf "/usr/bin/yq" || true | |
sudo rm -rf "/usr/local/share/vcpkg" || true | |
sudo rm -rf "/usr/local/bin/terraform" || true | |
sudo rm -rf "/usr/local/bin/stack" || true | |
sudo rm -rf "/usr/local/bin/aliyun" || true | |
sudo rm -rf "/usr/local/bin/pulumi" || true | |
sudo rm -rf "/usr/local/bin/pulumi-language-dotnet" || true | |
sudo rm -rf "/usr/local/bin/azcopy" || true | |
sudo rm -rf "/usr/local/aws-cli" || true | |
sudo rm -rf "/usr/local/bin/bicep" || true | |
sudo rm -rf "/usr/local/bin/rebar3" || true | |
sudo rm -rf "/usr/local/bin/phpunit" || true | |
sudo rm -rf "/usr/local/bin/packer" || true | |
sudo rm -rf "/usr/local/bin/bicep" || true | |
sudo rm -rf "/usr/local/bin/docker-compose" || true | |
sudo rm -rf "$HOME/.dotnet/tools" || true | |
sudo rm -rf "/etc/skel/.dotnet/tools" || true | |
sudo rm -rf "/usr/local/bin/minikube" || true | |
sudo rm -rf "/usr/local/bin/kustomize" || true | |
sudo rm -rf "/usr/local/bin/kubectl" || true | |
sudo rm -rf "/usr/local/bin/kind" || true | |
sudo rm -rf "/usr/local/bin/helm" | |
sudo docker image prune --all --force | |
sudo npm uninstall bazel | |
rustup self uninstall -y | |
sudo apt purge \ | |
ansible \ | |
aria2 \ | |
azure-cli \ | |
cabal* \ | |
clang* \ | |
dotnet-sdk* \ | |
ghc* \ | |
google-chrome-stable \ | |
kubectl \ | |
mysql* \ | |
node* \ | |
npm* \ | |
php* \ | |
powershell \ | |
rpm \ | |
ruby* \ | |
subversion \ | |
yarn \ | |
firefox \ | |
mono-complete \ | |
nuget \ | |
apache2 \ | |
moby-engine \ | |
moby-cli \ | |
moby-buildx \ | |
moby-compose \ | |
microsoft-edge-stable \ | |
mongodb* \ | |
nginx \ | |
postgresql* \ | |
libpq-dev \ | |
r-base \ | |
sphinxsearch \ | |
swig \ | |
tcl \ | |
temurin-* \ | |
skopeo \ | |
imagemagick-* \ | |
mssql-tools* \ | |
unixodbc-dev \ | |
ubuntu-advantage-tools \ | |
docker-* \ | |
fonts-* \ | |
llvm-* \ | |
javascript-common \ | |
openjdk-11-jre-headless \ | |
linux-cloud-tools* \ | |
linux-azure-6.2-* \ | |
hicolor-icon-theme \ | |
gcc-9 \ | |
gcc-10 \ | |
gcc-11 \ | |
gcc-12 \ | |
cloud-initramfs* \ | |
x11-* \ | |
bind9-* \ | |
cloud-* \ | |
gir1.2-* \ | |
golang-github-* \ | |
libjs-* \ | |
libllvm* \ | |
nano \ | |
podman \ | |
buildah \ | |
skopeo \ | |
-yq > /dev/null 2>&1 || true | |
sudo apt-get autoremove -y > /dev/null 2>&1 || true | |
sudo apt-get autoclean -y > /dev/null 2>&1 || true | |
df -h | |
- name: load lxc image | |
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export | |
- name: launch lxc container | |
run: ./tests/launch_test_lxc.sh test-export | |
- name: run test | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && sudo /home/ubuntu/d4c/tests/test_bsdiffx.sh" | |
- name: run benchmark | |
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && RUNNER=GHA sudo -E /home/ubuntu/d4c/tests/bench.sh" | |
- name: get result | |
id: get_result | |
run: | | |
mkdir /tmp/benchmark-results | |
sudo lxc file pull test/tmp/benchmark/benchmark.log /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/compare.log /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/diff.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/pull.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/merge.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/patch.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/file_diff.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/file_compare.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/file_io.png /tmp/benchmark-results/. | |
sudo lxc file pull test/tmp/benchmark/file_io_with_type.png /tmp/benchmark-results/. | |
- uses: actions/upload-artifact@v4 | |
if: steps.get_result.conclusion == 'success' | |
with: | |
name: benchmark | |
path: /tmp/benchmark-results |