From f281d750ce14d2f23112411c3ae8aaf1a6684df8 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sat, 10 Feb 2024 13:44:30 +0900 Subject: [PATCH 1/5] Add Docker run command for private-isu-benchmarker --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f4044f72..fd370cbf6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,3 +55,4 @@ jobs: run: | cd benchmarker docker build -t private-isu-benchmarker . + docker run --network host --add-host host.docker.internal:host-gateway -i private-isu-benchmarker /opt/go/bin/benchmarker -t http://host.docker.internal -u /opt/go/userdata From 9ff4d8aaf897c6611067e09147a9f2914b386f30 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sat, 10 Feb 2024 13:53:01 +0900 Subject: [PATCH 2/5] Add "Show logs" step in CI workflow --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd370cbf6..a39308bb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,3 +56,8 @@ jobs: cd benchmarker docker build -t private-isu-benchmarker . docker run --network host --add-host host.docker.internal:host-gateway -i private-isu-benchmarker /opt/go/bin/benchmarker -t http://host.docker.internal -u /opt/go/userdata + + - name: Show logs + run: | + cd webapp + docker compose logs From d6bf51a0c582ef1a428f4b2c926672b9153f2d33 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sat, 10 Feb 2024 13:59:25 +0900 Subject: [PATCH 3/5] Add continue-on-error flag for benchmark job --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a39308bb8..4b51909b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: docker compose up -d - name: Run the benchmark + continue-on-error: true run: | cd benchmarker docker build -t private-isu-benchmarker . From a95e19d57cd457b1d86688b6eeb7bd835e67c72c Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sat, 10 Feb 2024 14:26:59 +0900 Subject: [PATCH 4/5] Build benchmark and wait for data initialization before running benchmark --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b51909b2..7885cfcee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,11 +51,23 @@ jobs: cd webapp docker compose up -d + - name: Build the benchmark + run: | + cd benchmarker + docker build -t private-isu-benchmarker . + + - name: Wait for data initialization to complete + run: | + cd webapp + until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM posts LIMIT 1;" isuconp; do + echo "Waiting for database initialization..." + sleep 10 + done + - name: Run the benchmark continue-on-error: true run: | cd benchmarker - docker build -t private-isu-benchmarker . docker run --network host --add-host host.docker.internal:host-gateway -i private-isu-benchmarker /opt/go/bin/benchmarker -t http://host.docker.internal -u /opt/go/userdata - name: Show logs From dd6236cc53e0549d0009198a4097800222dd1f64 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sat, 10 Feb 2024 14:38:28 +0900 Subject: [PATCH 5/5] Initialize and wait for database in CI workflow --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7885cfcee..19ca80be7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,15 @@ jobs: echo "Waiting for database initialization..." sleep 10 done + until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM users LIMIT 1;" isuconp; do + echo "Waiting for database initialization..." + sleep 10 + done + until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM comments LIMIT 1;" isuconp; do + echo "Waiting for database initialization..." + sleep 10 + done + sleep 10 - name: Run the benchmark continue-on-error: true