Skip to content

Commit 0b77359

Browse files
committed
test: print logs
1 parent 0a76a03 commit 0b77359

File tree

1 file changed

+6
-36
lines changed

1 file changed

+6
-36
lines changed

scripts/examples-generate.sh

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
1010
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
1111

1212
echo "⏳ Generating client code for all examples..."
13-
# Build the CLI package so its bin is available to examples in the workspace.
14-
echo "Building @hey-api/openapi-ts (required for example generation)..."
15-
if pnpm -w -s --version >/dev/null 2>&1; then
16-
pnpm -w -s --filter "@hey-api/openapi-ts" build
17-
else
18-
pnpm -s --filter "@hey-api/openapi-ts" build
19-
fi
2013

2114
# Find all examples with openapi-ts script and generate code in parallel
2215
# Concurrency control: adjust this number depending on CI machine resources
@@ -52,24 +45,8 @@ for dir in "$ROOT_DIR"/examples/*/; do
5245
echo "Generating: $example_name"
5346
set -e
5447
cd "$dir"
55-
echo "-> Debug: node $(node --version 2>/dev/null || echo 'node-not-found')"
56-
echo "-> Debug: pnpm $(pnpm --version 2>/dev/null || echo 'pnpm-not-found')"
57-
echo "-> Debug: pwd $(pwd)"
58-
echo "-> Running pnpm run openapi-ts (invokes package script in example)"
59-
# Run the example's package script so pnpm resolves the workspace binary correctly
60-
# Use silent mode to keep logs concise but preserve errors
61-
echo "--- begin openapi-ts output ---"
62-
if pnpm -s --version >/dev/null 2>&1; then
63-
pnpm -s run openapi-ts || rc=$?
64-
else
65-
pnpm run openapi-ts || rc=$?
66-
fi
67-
rc=${rc:-0}
68-
echo "--- end openapi-ts output (rc=$rc) ---"
69-
if [ "$rc" -ne 0 ]; then
70-
echo "openapi-ts failed with exit code $rc"
71-
exit $rc
72-
fi
48+
echo "-> Running openapi-ts"
49+
pnpm run openapi-ts
7350

7451
# Format generated files in this example only to keep the step fast
7552
if command -v pnpm >/dev/null 2>&1 && pnpm -w -s --version >/dev/null 2>&1; then
@@ -103,17 +80,10 @@ for pid in $PIDS; do
10380
# Read the metadata file which contains the path to the real log
10481
logpath=$(cat "$tmpdir/$pid.log" 2>/dev/null || echo "")
10582
if [ -n "$logpath" ] && [ -f "$logpath" ]; then
106-
echo "$name failed — showing log excerpt ($logpath):"
107-
echo "---- log excerpt (last 200 lines) ----"
108-
tail -n 200 "$logpath" || true
109-
echo "---- possible error lines (case-insensitive match: error|exception|failed) ----"
110-
if grep -iE 'error|exception|failed' "$logpath" >/dev/null 2>&1; then
111-
# show up to 200 matching lines to keep CI output bounded
112-
grep -iE 'error|exception|failed' "$logpath" | sed -n '1,200p' || true
113-
else
114-
echo "(no obvious error lines found in log)"
115-
fi
116-
echo "Full log available at: $logpath"
83+
echo "$name failed — showing full log ($logpath):"
84+
echo "---- full log start ----"
85+
cat "$logpath" || true
86+
echo "---- full log end ----"
11787
else
11888
echo "$name failed — no log found (metadata: $tmpdir/$pid.log)"
11989
fi

0 commit comments

Comments
 (0)