ci: migrasi CI/Dockerfile/install.sh ke Bun — setup-bun + bun install/check/test + --compile single binary; release gate ke bun run check

This commit is contained in:
asepharyana
2026-09-02 22:50:38 +07:00
parent 5d65c78fb4
commit 170b1d3d19
5 changed files with 63 additions and 52 deletions
+24 -14
View File
@@ -3,29 +3,39 @@ set -euo pipefail
BIN_NAME="zesdex"
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
TARGET_DIR="$REPO_DIR/target/release"
BIN_PATH="$TARGET_DIR/$BIN_NAME"
TMP_BIN="/tmp/$BIN_NAME"
echo "==> Building $BIN_NAME (release)..."
cargo build --release --manifest-path "$REPO_DIR/Cargo.toml"
if [ ! -f "$BIN_PATH" ]; then
echo "ERROR: build succeeded but binary not found at $BIN_PATH" >&2
# Need Bun to compile the CLI.
if ! command -v bun >/dev/null 2>&1; then
echo "ERROR: 'bun' is required to build $BIN_NAME." >&2
echo "Install it from https://bun.sh (curl -fsSL https://bun.sh/install | bash)" >&2
exit 1
fi
echo "==> Binary built: $BIN_PATH"
echo "==> Installing dependencies..."
bun install --cwd "$REPO_DIR" --frozen-lockfile
echo "==> Compiling $BIN_NAME (self-contained executable)..."
bun build "$REPO_DIR/apps/interfaces/cli/src/index.ts" --compile --outfile "$TMP_BIN"
if [ ! -f "$TMP_BIN" ]; then
echo "ERROR: build succeeded but binary not found at $TMP_BIN" >&2
exit 1
fi
chmod +x "$TMP_BIN"
echo "==> Binary built: $TMP_BIN"
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
mkdir -p "$INSTALL_DIR"
SYMLINK_PATH="$INSTALL_DIR/$BIN_NAME"
BIN_PATH="$INSTALL_DIR/$BIN_NAME"
if [ -L "$SYMLINK_PATH" ] || [ -f "$SYMLINK_PATH" ]; then
echo "==> Removing existing symlink or file at $SYMLINK_PATH"
rm -f "$SYMLINK_PATH"
if [ -L "$BIN_PATH" ] || [ -f "$BIN_PATH" ]; then
echo "==> Removing existing symlink or file at $BIN_PATH"
rm -f "$BIN_PATH"
fi
ln -s "$BIN_PATH" "$SYMLINK_PATH"
echo "==> Symlinked: $SYMLINK_PATH -> $BIN_PATH"
mv "$TMP_BIN" "$BIN_PATH"
echo "==> Installed: $BIN_PATH"
echo ""
echo "Done. Make sure $INSTALL_DIR is in your PATH."