fix: CLI binary not executable when postinstall is skipped (pnpm, bun) (#285)
* fix binary * check binary in CI
This commit is contained in:
@@ -187,20 +187,27 @@ jobs:
|
|||||||
"agent-browser-darwin-x64"
|
"agent-browser-darwin-x64"
|
||||||
"agent-browser-darwin-arm64"
|
"agent-browser-darwin-arm64"
|
||||||
)
|
)
|
||||||
MISSING=0
|
MIN_SIZE=100000 # Binaries should be at least 100KB
|
||||||
|
ERRORS=0
|
||||||
for binary in "${EXPECTED_BINARIES[@]}"; do
|
for binary in "${EXPECTED_BINARIES[@]}"; do
|
||||||
if [ ! -f "bin/$binary" ]; then
|
if [ ! -f "bin/$binary" ]; then
|
||||||
echo "Missing: bin/$binary"
|
echo "ERROR: Missing bin/$binary"
|
||||||
MISSING=$((MISSING + 1))
|
ERRORS=$((ERRORS + 1))
|
||||||
else
|
else
|
||||||
echo "Found: bin/$binary ($(stat -c%s "bin/$binary" 2>/dev/null || stat -f%z "bin/$binary") bytes)"
|
SIZE=$(stat -c%s "bin/$binary" 2>/dev/null || stat -f%z "bin/$binary")
|
||||||
|
if [ "$SIZE" -lt "$MIN_SIZE" ]; then
|
||||||
|
echo "ERROR: bin/$binary is too small ($SIZE bytes, expected >= $MIN_SIZE)"
|
||||||
|
ERRORS=$((ERRORS + 1))
|
||||||
|
else
|
||||||
|
echo "OK: bin/$binary ($SIZE bytes)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "$MISSING" -gt 0 ]; then
|
if [ "$ERRORS" -gt 0 ]; then
|
||||||
echo "Error: $MISSING binaries are missing"
|
echo "Error: $ERRORS binary issues found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "All 5 platform binaries present"
|
echo "All 5 platform binaries present and valid"
|
||||||
|
|
||||||
- name: Create Release Pull Request or Publish to npm
|
- name: Create Release Pull Request or Publish to npm
|
||||||
id: changesets
|
id: changesets
|
||||||
|
|||||||
+3
-1
@@ -17,7 +17,9 @@ case "$ARCH" in x86_64|amd64) ARCH="x64" ;; aarch64|arm64) ARCH="arm64" ;; esac
|
|||||||
|
|
||||||
BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
|
BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
|
||||||
|
|
||||||
if [ -f "$BINARY" ] && [ -x "$BINARY" ]; then
|
if [ -f "$BINARY" ]; then
|
||||||
|
# Ensure binary is executable (npm tarballs don't preserve execute bit)
|
||||||
|
[ -x "$BINARY" ] || chmod +x "$BINARY" 2>/dev/null
|
||||||
exec "$BINARY" "$@"
|
exec "$BINARY" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user