From 3b474e31fdd64c4188ead158e403556c5017f074 Mon Sep 17 00:00:00 2001 From: Max Tropets Date: Fri, 4 Sep 2026 13:56:35 +0100 Subject: [PATCH] Only build required targets for bencher Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41b05883-5e0c-4bde-a945-0de0ceccde8e --- .github/workflows/bencher.yml | 46 +++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bencher.yml b/.github/workflows/bencher.yml index 7f07635c993..5e2e0378636 100644 --- a/.github/workflows/bencher.yml +++ b/.github/workflows/bencher.yml @@ -88,11 +88,32 @@ jobs: - name: Build and run virtual perf tests run: | + set -eo pipefail git config --global --add safe.directory /__w/CCF/CCF mkdir build cd build cmake -GNinja -DWORKER_THREADS=2 .. - ninja + # Build only the binaries the benchmark and perf suites actually run. + # A bare `ninja` also builds every unit-test binary, which this job + # never executes and which dominates the build. + # add_picobench names each test after its executable target + readarray -t bench_targets < <( + ctest -N -L benchmark | sed -n 's/^ *Test *#[0-9]*: //p' + ) + # perf tests name the app they need on their command line + readarray -t app_targets < <( + ctest -N -V -L perf -C perf | tr ' ' '\n' | tr -d '"' | awk ' + /^--package$/ { getline; print } + /^-c$/ { getline; sub(/^\.\//, ""); print } + /^--js-app-bundle$/ { print "js_generic" }' | sort -u + ) + # Guard each half separately: the benchmark names alone would satisfy + # a combined count check even if app discovery silently returned none. + if [ "${#bench_targets[@]}" -eq 0 ] || [ "${#app_targets[@]}" -eq 0 ]; then + echo "Derived ${#bench_targets[@]} benchmark and ${#app_targets[@]} app targets, expected both non-empty" >&2 + exit 1 + fi + ninja "${bench_targets[@]}" "${app_targets[@]}" # Microbenchmarks ./tests.sh -VV -L benchmark # End to end performance tests @@ -177,11 +198,32 @@ jobs: - name: Build and run SNP perf tests run: | + set -eo pipefail git config --global --add safe.directory /__w/CCF/CCF mkdir build cd build cmake -GNinja -DWORKER_THREADS=2 .. - ninja + # Build only the binaries the benchmark and perf suites actually run. + # A bare `ninja` also builds every unit-test binary, which this job + # never executes and which dominates the build. + # add_picobench names each test after its executable target + readarray -t bench_targets < <( + ctest -N -L benchmark | sed -n 's/^ *Test *#[0-9]*: //p' + ) + # perf tests name the app they need on their command line + readarray -t app_targets < <( + ctest -N -V -L perf -C perf | tr ' ' '\n' | tr -d '"' | awk ' + /^--package$/ { getline; print } + /^-c$/ { getline; sub(/^\.\//, ""); print } + /^--js-app-bundle$/ { print "js_generic" }' | sort -u + ) + # Guard each half separately: the benchmark names alone would satisfy + # a combined count check even if app discovery silently returned none. + if [ "${#bench_targets[@]}" -eq 0 ] || [ "${#app_targets[@]}" -eq 0 ]; then + echo "Derived ${#bench_targets[@]} benchmark and ${#app_targets[@]} app targets, expected both non-empty" >&2 + exit 1 + fi + ninja "${bench_targets[@]}" "${app_targets[@]}" # Microbenchmarks ./tests.sh -VV -L benchmark -E task_bench # End to end performance tests