Skip to content

Commit f03b65d

Browse files
Refactor example build and run logic in CI workflow for improved clarity and functionality
Signed-off-by: Alex Lovell-Troy <[email protected]>
1 parent 5d755af commit f03b65d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,10 @@ jobs:
4141
4242
- name: Build and run examples
4343
run: |
44-
for pkg in $(go list ./... | grep '/example' || true); do
45-
echo "Building $pkg"
46-
go build -v "$pkg"
47-
BIN=$(basename "$pkg")
48-
# Try to run the binary if built successfully
49-
if [ -f "$BIN" ]; then
50-
echo "Running $BIN"
51-
./"$BIN"
52-
else
53-
echo "Binary $BIN not found, skipping run."
54-
fi
44+
for f in example/*.go; do
45+
fname=$(basename "$f" .go)
46+
echo "Building $f -> $fname"
47+
go build -o "example/$fname" "$f"
48+
echo "Running example/$fname"
49+
"example/$fname"
5550
done

0 commit comments

Comments
 (0)