From 6f762fbae1dcea5f37674cbf3b151daf9acd4a3e Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Sat, 4 Jul 2026 21:48:08 +0200 Subject: [PATCH] fix(ci): align benchmark json flag handling and pin gobenchdata --- .github/workflows/benchmark.yml | 2 +- ci/scripts/bench.sh | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 4b1fad9a7..9ec92659c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -52,7 +52,7 @@ jobs: check-latest: false - name: Run Benchmarks if: github.event_name != 'push' - run: bash ci/scripts/bench.sh $(pwd) --json + run: bash ci/scripts/bench.sh $(pwd) -json - name: Upload results if: github.event_name == 'push' && github.repository == 'apache/arrow-go' && github.ref_name == 'main' env: diff --git a/ci/scripts/bench.sh b/ci/scripts/bench.sh index 597b2a19c..1485ea459 100644 --- a/ci/scripts/bench.sh +++ b/ci/scripts/bench.sh @@ -17,8 +17,8 @@ # specific language governing permissions and limitations # under the License. -# this will output the benchmarks to STDOUT but if `-json` is passed -# as the second argument, it will create a file "bench_stats.json" +# this will output the benchmarks to STDOUT but if `-json` or `--json` is +# passed as an argument, it will create a file "bench_stats.json" # in the directory this is called from containing a json representation set -ex @@ -30,6 +30,15 @@ if [ -z "$1" ]; then fi source_dir="$1" +json_requested=false + +for arg in "$@"; do + case "$arg" in + -json|--json) + json_requested=true + ;; + esac +done PARQUET_TEST_DATA="${source_dir}/parquet-testing/data" export PARQUET_TEST_DATA @@ -43,8 +52,8 @@ go test -bench=. -benchmem -timeout 40m -run=^$ ./... | tee bench_stat.dat popd -if [[ "$2" = "-json" ]]; then - go install go.bobheadxi.dev/gobenchdata@latest +if [[ "${json_requested}" == "true" ]]; then + go install go.bobheadxi.dev/gobenchdata@v1.3.1 PATH=$(go env GOPATH)/bin:$PATH export PATH cat "${source_dir}"/bench_*.dat | gobenchdata --json bench_stats.json