Skip to content

Commit a61cce3

Browse files
committed
fix(size-benchmark): always use head's build script, support WORKSPACE_ROOT override
1 parent c934b2f commit a61cce3

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

size-benchmark/build-size-optimized.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
set -euo pipefail
1515

1616
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17-
WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
17+
WORKSPACE_ROOT="${WORKSPACE_ROOT:-$(cd "$SCRIPT_DIR/.." && pwd)}"
1818

1919
ARCH="$(uname -m | sed 's/arm64/aarch64/')"
2020
OS="$(uname -s)"

size-benchmark/compare-size.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set -euo pipefail
1010

1111
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1212
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
13+
BUILD_SCRIPT="$SCRIPT_DIR/build-size-optimized.sh"
1314

1415
BASE_REF=""
1516
HEAD_REF=""
@@ -49,10 +50,13 @@ build_ref() {
4950
git -C "$REPO_ROOT" worktree add --detach "$worktree" "$ref" 2>&1 | sed 's/^/ /' >&2
5051

5152
# cargo writes to stderr; wc -c is the only stdout line.
53+
# Always use the script from the current checkout (base may not have it).
54+
# Override WORKSPACE_ROOT so the script builds the worktree, not itself.
5255
# Point CARGO_TARGET_DIR at the main worktree so both builds share the cache.
5356
# Redirect build stderr → our stderr so CI logs show progress.
5457
CARGO_TARGET_DIR="$REPO_ROOT/target" \
55-
bash "$worktree/size-benchmark/build-size-optimized.sh" 2>&3
58+
WORKSPACE_ROOT="$worktree" \
59+
bash "$BUILD_SCRIPT" 2>&3
5660
# (stdout = byte count, captured by the caller via $())
5761

5862
git -C "$REPO_ROOT" worktree remove --force "$worktree" 2>/dev/null || true

0 commit comments

Comments
 (0)