Files
galaxy/script/test_galaxy_bundle_targets

79 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
workspace_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
temp_dir="$(mktemp -d)"
trap 'rm -rf "$temp_dir"' EXIT
mkdir -p "$temp_dir/bin"
cat > "$temp_dir/bin/cargo" <<'EOF'
#!/usr/bin/env bash
printf '%s\n' "$@" > "$CARGO_ARGS_FILE"
EOF
chmod +x "$temp_dir/bin/cargo"
assert_cargo_target() {
local args_file="$1"
local expected_bin="$2"
grep -qx -- 'galaxy' "$args_file"
grep -qx -- '--bin' "$args_file"
grep -qx -- "$expected_bin" "$args_file"
if grep -Eqx -- 'warp|warp-oss|local|dev|preview|stable' "$args_file"; then
echo "Found a removed Cargo package or binary target in $args_file" >&2
exit 1
fi
}
for channel_and_bin in \
"oss galaxy-oss"
do
channel="${channel_and_bin%% *}"
expected_bin="${channel_and_bin#* }"
linux_args="$temp_dir/linux-$channel.args"
PATH="$temp_dir/bin:$PATH" \
CARGO_ARGS_FILE="$linux_args" \
CARGO_TARGET_DIR="$temp_dir/target" \
"$workspace_root/script/linux/bundle" \
--check-only \
--channel "$channel" \
--packages none
assert_cargo_target "$linux_args" "$expected_bin"
wasm_args="$temp_dir/wasm-$channel.args"
PATH="$temp_dir/bin:$PATH" \
CARGO_ARGS_FILE="$wasm_args" \
"$workspace_root/script/wasm/bundle" \
--check-only \
--channel "$channel"
assert_cargo_target "$wasm_args" "$expected_bin"
done
macos_bundle="$workspace_root/script/macos/bundle"
grep -Fq -- 'CLI_SCRIPT_PATH="$BUNDLED_RESOURCES_DIR/bin/galaxy-ai-oss"' "$macos_bundle"
if grep -Eq -- 'CLI_SCRIPT_PATH=.*(warp|oz)' "$macos_bundle"; then
echo "Found a removed Warp/Oz CLI launcher in $macos_bundle" >&2
exit 1
fi
windows_bundle="$workspace_root/script/windows/bundle.ps1"
grep -Fq -- "\$GALAXY_BIN = 'galaxy-oss'" "$windows_bundle"
grep -Fq -- 'cargo check -p galaxy' "$windows_bundle"
grep -Fq -- 'cargo build -p galaxy' "$windows_bundle"
if grep -Eq -- "cargo (check|build) -p warp|\\\$GALAXY_BIN = '(warp|warp-oss|dev|preview)'" "$windows_bundle"; then
echo "Found a removed Cargo package or binary target in $windows_bundle" >&2
exit 1
fi
windows_installer="$workspace_root/script/windows/windows-installer.iss"
grep -Fq -- "AppId=com.galaxy.GalaxyOss" "$windows_installer"
grep -Fq -- "CmdScriptName := 'galaxy-ai-oss.cmd'" "$windows_installer"
grep -Fq -- 'set "GALAXY_CLI_MODE=1"' "$windows_installer"
grep -Fq -- 'WizardSmallImageFile="installer-images\galaxy-logo.bmp"' "$windows_installer"
grep -Fq -- 'WizardImageFile="installer-images\galaxy-banner.bmp"' "$windows_installer"
if grep -Eq -- "CmdScriptName := '(warp|oz)|AppId=warp-terminal|SOFTWARE\\\\Warp|dev\\.warp|installer-images\\\\warp" "$windows_installer"; then
echo "Found removed Warp/Oz installer branding in $windows_installer" >&2
exit 1
fi