From f2c11e923dab7c720c508156cde4a1a74f18089c Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Thu, 4 Jul 2024 09:41:50 +0530 Subject: [PATCH] test cloud results Signed-off-by: Sahil Yeole --- .github/workflows/bench.yml | 6 ++++++ k6/bench.sh | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index baf9de732..0e8600785 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -24,6 +24,9 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} + - name: Set IS_PUSH environment variable + if: github.ref == 'refs/heads/main' + run: echo "IS_PUSH=true" >> $GITHUB_ENV - name: Build devcontainer uses: devcontainers/ci@v0.3 @@ -35,7 +38,10 @@ jobs: uses: grafana/setup-k6-action@v1 - name: Run benchmarks + env: + IS_PUSH: ${{ env.IS_PUSH }} run: | + echo "IS_PUSH is set to $IS_PUSH" bash ./setup.sh bash ./run_benchmarks.sh diff --git a/k6/bench.sh b/k6/bench.sh index e268b5a2d..e9234eb78 100644 --- a/k6/bench.sh +++ b/k6/bench.sh @@ -1,5 +1,8 @@ test_name=$1 benchmark=$2 -# k6 run k6/bench.js --quiet --out cloud --env TEST_NAME=$test_name --env BENCHMARK=$benchmark -k6 run k6/bench.js --quiet --env TEST_NAME=$test_name --env BENCHMARK=$benchmark +if [ "$IS_PUSH" = "true" ]; then + k6 run k6/bench.js --quiet --out cloud --env TEST_NAME=$test_name --env BENCHMARK=$benchmark +else + k6 run k6/bench.js --quiet --env TEST_NAME=$test_name --env BENCHMARK=$benchmark +fi