-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
408 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
--- | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- release/** | ||
- gha | ||
pull_request: null | ||
workflow_dispatch: | ||
|
||
jobs: | ||
golangci-lint: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21.x | ||
- run: sudo apt-get update | ||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
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/[email protected] | ||
|
||
- uses: actions/cache/restore@v3 | ||
id: cache-restore | ||
with: | ||
key: lxc-image-base-${{ hashFiles('go.sum', 'tests/setup_test.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@v3 | ||
id: s5 | ||
if: steps.s4.conclusion == 'success' | ||
with: | ||
key: lxc-image-base-${{ hashFiles('go.sum', 'tests/setup_test.sh') }} | ||
path: /tmp/test-image.tar.zst | ||
|
||
sync: | ||
runs-on: ubuntu-22.04 | ||
needs: create-lxc-image | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: setup lxd | ||
run: ./tests/setup_lxd.sh | ||
- uses: actions/cache/restore@v3 | ||
id: cache-restore | ||
with: | ||
key: lxc-image-base-${{ hashFiles('go.sum', 'test/setup_test.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/bypass4netns/test/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 && ./test/export_lxc_image.sh test | ||
- uses: actions/cache/save@v3 | ||
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"] | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: setup lxd | ||
run: ./tests/setup_lxd.sh | ||
- uses: actions/cache/restore@v3 | ||
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: ./test/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 && /home/ubuntu/d4c/tests/bench_lxc.sh ${{ matrix.script }}" | ||
- name: get result | ||
id: get_result | ||
run: | | ||
mkdir /tmp/benchmark-results | ||
sudo lxc file pull test/home/ubuntu/d4c/tests/benchmark/${{ matrix.script }}-benchmark.log /tmp/benchmark-results/. | ||
- uses: actions/upload-artifact@v3 | ||
if: steps.get_result.conclusion == 'success' | ||
with: | ||
name: benchmark-${{ matrix.script }} | ||
path: /tmp/benchmark-results |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ | |
/diff | ||
/pack | ||
/server | ||
/fuse-diff | ||
/merge | ||
/patch |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
* | ||
!/.gitignore | ||
!/postgres | ||
!/simple-dir | ||
!/run-tests.sh | ||
!/bench*.sh | ||
!/bench-*.py | ||
!/push-*.sh | ||
!/scp*.sh | ||
!version.sh | ||
/server | ||
/benchmark_* |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
if [ $EUID -ne 0 ]; then | ||
echo "root previlige required" | ||
exit 1 | ||
fi | ||
|
||
RUN_NUM=1 | ||
TEST=$1 | ||
|
||
PATH=$PATH:/usr/local/go/bin | ||
|
||
cd $(cd $(dirname $0); pwd) | ||
pushd ../ | ||
make all | ||
popd | ||
|
||
RESULT_DIR=benchmark | ||
IMAGE_DIR=$RESULT_DIR/images | ||
mkdir -p $IMAGE_DIR | ||
|
||
echo "Benchmarking $TEST" | ||
./bench_impl.sh test_$TEST.sh $IMAGE_DIR $RUN_NUM | ||
cp $IMAGE_DIR/$TEST/benchmark.log ./$RESULT_DIR/$TEST-benchmark.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -eux -o pipefail | ||
|
||
IMAGE_NAME=$1 | ||
|
||
sudo lxc snapshot $IMAGE_NAME snp0 | ||
sudo lxc publish $IMAGE_NAME/snp0 --alias $IMAGE_NAME-export --compression zstd | ||
sudo lxc image export $IMAGE_NAME-export /tmp/$IMAGE_NAME-image |
Oops, something went wrong.