Skip to content

Commit 1833ed2

Browse files
committed
fix: use bazel cquery to get actual component paths instead of symlinks
The bazel-bin symlink doesn't work reliably in CI. Use bazel cquery to get the actual output paths and store them in environment variables. Changes: - Query actual paths for COMPONENT_WASM and AOT_COMPONENT after building - Use environment variables in all wasmtime benchmark commands - Remove hardcoded bazel-bin paths Tested locally to confirm bazel cquery returns correct paths.
1 parent 823f79d commit 1833ed2

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

.github/workflows/performance.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,21 @@ jobs:
9696
# Build TinyGo component (regular version)
9797
bazel build //tinygo:file_ops_component
9898
99+
# Get actual file path from bazel (not symlink)
100+
COMPONENT_PATH=$(bazel cquery --output=files //tinygo:file_ops_component 2>/dev/null | head -1)
101+
echo "COMPONENT_WASM=$COMPONENT_PATH" >> $GITHUB_ENV
102+
echo "Built component at: $COMPONENT_PATH"
103+
99104
# Build platform-specific AOT precompiled component
100105
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
101106
bazel build //tinygo:file_ops_aot_linux_x64
107+
AOT_PATH=$(bazel cquery --output=files //tinygo:file_ops_aot_linux_x64 2>/dev/null | head -1)
102108
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
103109
bazel build //tinygo:file_ops_aot_darwin_arm64
110+
AOT_PATH=$(bazel cquery --output=files //tinygo:file_ops_aot_darwin_arm64 2>/dev/null | head -1)
104111
fi
112+
echo "AOT_COMPONENT=$AOT_PATH" >> $GITHUB_ENV
113+
echo "Built AOT component at: $AOT_PATH"
105114
106115
# Note: Rust implementation is not yet available
107116
# Future: Add Rust component builds when implemented
@@ -144,14 +153,14 @@ jobs:
144153
if command -v wasmtime &> /dev/null; then
145154
# Test the command first to see if it works
146155
echo "Testing WASM component execution..."
147-
if wasmtime run --dir=. --dir=perf_test_data bazel-bin/tinygo/file_ops_component.wasm copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_copy.txt; then
156+
if wasmtime run --dir=. --dir=perf_test_data "$COMPONENT_WASM" copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_copy.txt; then
148157
echo "✅ WASM component test passed, running benchmarks..."
149158
150159
# Run benchmark with proper error handling
151160
hyperfine --export-json tinygo_wasm_benchmark.json \
152161
--warmup 3 \
153162
--show-output \
154-
'wasmtime run --dir=. --dir=perf_test_data bazel-bin/tinygo/file_ops_component.wasm copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_copy.txt' \
163+
"wasmtime run --dir=. --dir=perf_test_data $COMPONENT_WASM copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_copy.txt" \
155164
|| echo "⚠️ Benchmark failed but continuing" >> perf_results.md
156165
157166
echo "✅ TinyGo component benchmarks completed" >> perf_results.md
@@ -171,21 +180,12 @@ jobs:
171180
echo "| Operation | Time (ms) | Memory (MB) | Notes |" >> perf_results.md
172181
echo "|-----------|-----------|-------------|-------|" >> perf_results.md
173182
174-
# Determine AOT file path based on platform
175-
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
176-
AOT_FILE="bazel-bin/tinygo/file_ops_aot_linux_x64.cwasm"
177-
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
178-
AOT_FILE="bazel-bin/tinygo/file_ops_aot_darwin_arm64.cwasm"
179-
else
180-
echo "⚠️ Unsupported platform for AOT benchmarks" >> perf_results.md
181-
exit 0
182-
fi
183-
184-
# WebAssembly AOT runtime benchmark
183+
# WebAssembly AOT runtime benchmark using path from build step
185184
if command -v wasmtime &> /dev/null; then
186185
# Test the AOT precompiled component first
187186
echo "Testing AOT precompiled component execution..."
188-
if wasmtime run --allow-precompiled --dir=. --dir=perf_test_data "$AOT_FILE" copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_aot_copy.txt; then
187+
echo "AOT component path: $AOT_COMPONENT"
188+
if wasmtime run --allow-precompiled --dir=. --dir=perf_test_data "$AOT_COMPONENT" copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_aot_copy.txt; then
189189
echo "✅ AOT component test passed, running benchmarks..."
190190
191191
# Run benchmark comparing regular vs AOT
@@ -195,7 +195,7 @@ jobs:
195195
hyperfine --export-json tinygo_aot_benchmark.json \
196196
--warmup 3 \
197197
--show-output \
198-
"wasmtime run --allow-precompiled --dir=. --dir=perf_test_data $AOT_FILE copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_aot_copy.txt" \
198+
"wasmtime run --allow-precompiled --dir=. --dir=perf_test_data $AOT_COMPONENT copy_file --src perf_test_data/small.txt --dest perf_test_data/wasm_aot_copy.txt" \
199199
|| echo "⚠️ AOT benchmark failed but continuing" >> perf_results.md
200200
201201
# Extract and compare results

0 commit comments

Comments
 (0)