first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+3 -1
View File
@@ -2,9 +2,11 @@
set -e
. "$PWD/script/warp_sudo"
# Update the apt cache before installing dependencies. It can be slow, so the install scripts
# don't do it (to avoid doing it more than once).
sudo apt update -y
warp_sudo apt update -y
# Install all dependencies needed to build, run, and test Warp.
"$PWD"/script/linux/install_test_deps
+74 -18
View File
@@ -5,8 +5,6 @@
set -e
WORKSPACE_ROOT_DIR="$(pwd)"
CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$WORKSPACE_ROOT_DIR/target}"
DIST_DIR="$CARGO_TARGET_DIR/dist"
cleanup() {
# Delete the directory that was used as a staging area during the bundling
@@ -22,6 +20,7 @@ trap cleanup EXIT
# By default we build dev bundles.
RELEASE_CHANNEL="dev"
FEATURES="release_bundle,crash_reporting"
EXTRA_FEATURES=""
PACKAGES=( appimage )
BUILD="true"
BUILD_ARCH="$(uname -m)"
@@ -75,10 +74,19 @@ while (( "$#" )); do
PACKAGES=( $(IFS=, ; echo $2) )
shift 2
;;
--features)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
EXTRA_FEATURES="$2"
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
--artifact)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
if [[ "$2" != "app" && "$2" != "cli" ]]; then
echo "Error: --artifact must be either 'app' or 'cli', got '$2'" >&2
if [[ "$2" != "app" && "$2" != "cli" && "$2" != "warpctrl" ]]; then
echo "Error: --artifact must be 'app', 'cli', or 'warpctrl', got '$2'" >&2
exit 1
fi
ARTIFACT="$2"
@@ -112,19 +120,37 @@ done
# set positional arguments in their proper place
eval set -- "$PARAMS"
# Statically compile the CLI and warpctrl artifacts so they can run on older Linux distros.
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
TARGET_TRIPLE="${BUILD_ARCH}-unknown-linux-musl"
# Only configure the musl toolchain when we are actually compiling. Packaging-only
# runs (--skip-build) just need TARGET_TRIPLE to locate the prebuilt binary, and
# configuring the toolchain there would force an unnecessary (and potentially
# failing) musl-cross download on hosts that never compile.
if [[ "$BUILD" == "true" ]]; then
source "$WORKSPACE_ROOT_DIR/script/linux/configure_musl_toolchain" "$TARGET_TRIPLE"
# Make sure we have the rust musl target available.
rustup target add "$TARGET_TRIPLE"
fi
fi
CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-$WORKSPACE_ROOT_DIR/target}"
CARGO_TARGET_OUTPUT_ROOT="$CARGO_TARGET_DIR${TARGET_TRIPLE:+/$TARGET_TRIPLE}"
DIST_DIR="$CARGO_TARGET_OUTPUT_ROOT/dist"
if [[ $DEBUG = true ]]; then
CARGO_PROFILE="dev"
elif [[ $RELEASE_CHANNEL = "local" || $RELEASE_CHANNEL = "dev" ]]; then
# For dev bundles, we want to enable debug assertions to
# catch violations that would otherwise silently pass in
# a normal release build (e.g. in stable).
if [[ "$ARTIFACT" == "cli" ]]; then
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
CARGO_PROFILE="release-cli-debug_assertions"
else
CARGO_PROFILE="release-lto-debug_assertions"
fi
else
if [[ "$ARTIFACT" == "cli" ]]; then
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
CARGO_PROFILE="release-cli"
else
CARGO_PROFILE="release-lto"
@@ -132,9 +158,9 @@ else
fi
if [[ "$CARGO_PROFILE" == "dev" ]]; then
CARGO_TARGET_OUTPUT_DIR="$CARGO_TARGET_DIR/debug"
CARGO_TARGET_OUTPUT_DIR="$CARGO_TARGET_OUTPUT_ROOT/debug"
else
CARGO_TARGET_OUTPUT_DIR="$CARGO_TARGET_DIR/$CARGO_PROFILE"
CARGO_TARGET_OUTPUT_DIR="$CARGO_TARGET_OUTPUT_ROOT/$CARGO_PROFILE"
fi
# NOTE: if you change this path, update the "Clean stale bundle output"
# steps in .github/workflows/create_release.yml so they continue to wipe
@@ -160,14 +186,16 @@ elif [[ $RELEASE_CHANNEL = "dev" ]]; then
BINARY_NAME="warp-dev"
APP_NAME="GalaxyDev"
FEATURES="$FEATURES,agent_mode_debug"
# Enable heap profiling using jemalloc through pprof.
FEATURES="$FEATURES,jemalloc_pprof"
# Enable heap usage tracking & profiling using jemalloc through pprof.
FEATURES="$FEATURES,jemalloc_pprof,heap_usage_tracking"
export HANDLE_MARKDOWN=1
elif [[ $RELEASE_CHANNEL = "preview" ]]; then
WARP_BIN="preview"
BINARY_NAME="warp-preview"
APP_NAME="GalaxyPreview"
FEATURES="$FEATURES,preview_channel"
# Enable heap usage tracking & profiling using jemalloc through pprof.
FEATURES="$FEATURES,jemalloc_pprof,heap_usage_tracking"
elif [[ $RELEASE_CHANNEL = "stable" ]]; then
WARP_BIN="stable"
BINARY_NAME="warp"
@@ -189,13 +217,23 @@ if [[ "$ARTIFACT" == "cli" ]]; then
if [[ $RELEASE_CHANNEL != "oss" ]]; then
BINARY_NAME="${BINARY_NAME/warp/oz}"
fi
elif [[ "$ARTIFACT" == "warpctrl" ]]; then
BINARY_NAME="warpctrl"
PACKAGES=()
fi
# Artifact-specific configuration
if [[ "$ARTIFACT" == "cli" ]]; then
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
FEATURES="$FEATURES,standalone"
if [[ "$ARTIFACT" == "warpctrl" ]]; then
FEATURES="$FEATURES,warp_control_cli"
fi
elif [[ "$ARTIFACT" == "app" ]]; then
FEATURES="$FEATURES,gui,nld_improvements"
# All channels ship the v3 classifier and v2 heuristic.
FEATURES="$FEATURES,gui,nld_classifier_v3,nld_heuristic_v2"
fi
if [[ -n "$EXTRA_FEATURES" ]]; then
FEATURES="$FEATURES,$EXTRA_FEATURES"
fi
BUNDLE_ID="dev.warp.$APP_NAME"
@@ -211,14 +249,15 @@ export APPIMAGE_NAME="$APP_NAME-$BUILD_ARCH.AppImage"
# then exit. We use this script to invoke `cargo check` to ensure that we are
# using the same feature flags and profile that we would be using in production.
if [[ "$CHECK_ONLY" == "true" ]]; then
cargo check -p warp --profile "$CARGO_PROFILE" --bin "$WARP_BIN" --features "$FEATURES"
cargo check -p warp --profile "$CARGO_PROFILE" --bin "$WARP_BIN" --features "$FEATURES" ${TARGET_TRIPLE:+--target $TARGET_TRIPLE}
exit 0
fi
# Build the binary.
if [[ "$BUILD" == "true" ]]; then
echo "Building and bundling Warp for channel $RELEASE_CHANNEL and bundle id $BUNDLE_ID"
cargo build -p warp --profile "$CARGO_PROFILE" --bin "$WARP_BIN" --features "$FEATURES"
cargo build -p warp --profile "$CARGO_PROFILE" --bin "$WARP_BIN" --features "$FEATURES" ${TARGET_TRIPLE:+--target $TARGET_TRIPLE}
echo "Making debug copy of '$EXECUTABLE_PATH' at '$DEBUG_EXECUTABLE_PATH'"
cp "$EXECUTABLE_PATH" "$DEBUG_EXECUTABLE_PATH"
@@ -226,18 +265,35 @@ if [[ "$BUILD" == "true" ]]; then
if [[ $RELEASE_CHANNEL = "dev" ]]; then
# For dev builds, only strip debug symbols, as we want to keep some
# symbols for profiling purposes.
strip --strip-debug "$EXECUTABLE_PATH"
"${WARP_MUSL_STRIP:-strip}" --strip-debug "$EXECUTABLE_PATH"
else
# For production builds, strip all symbols, to keep the binary size
# smaller.
strip --strip-all "$EXECUTABLE_PATH"
"${WARP_MUSL_STRIP:-strip}" --strip-all "$EXECUTABLE_PATH"
fi
else
echo 'Skipping `cargo build` step due to --skip-build argument'
fi
if [[ "$ARTIFACT" == "warpctrl" ]]; then
echo "Copying control-mode binary into $OUT_DIR/$WARP_BIN"
cp "$EXECUTABLE_PATH" "$OUT_DIR/$WARP_BIN"
WARPCTRL_SCRIPT_PATH="$OUT_DIR/warpctrl"
echo "Creating warpctrl wrapper script at $WARPCTRL_SCRIPT_PATH"
cat > "$WARPCTRL_SCRIPT_PATH" << EOF
#!/usr/bin/env bash
script_dir="\$(cd "\$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
exec "\$script_dir/$WARP_BIN" --warpctrl "\$@"
EOF
chmod +x "$WARPCTRL_SCRIPT_PATH"
fi
BINARY_PATH="$EXECUTABLE_PATH"
if [[ "$ARTIFACT" == "warpctrl" ]]; then
BINARY_PATH="$WARPCTRL_SCRIPT_PATH"
fi
# Prepare bundled resources for CLI builds.
if [[ "$ARTIFACT" == "cli" ]]; then
if [[ "$ARTIFACT" == "cli" || "$ARTIFACT" == "warpctrl" ]]; then
echo "Preparing CLI resources directory"
BUNDLED_RESOURCES_DIR="$OUT_DIR/resources"
"$WORKSPACE_ROOT_DIR/script/prepare_bundled_resources" "$BUNDLED_RESOURCES_DIR" "$RELEASE_CHANNEL" "$CARGO_PROFILE"
@@ -249,7 +305,7 @@ fi
# as the directory containing all built packages.
if [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "::echo::on"
echo "executable_path=$EXECUTABLE_PATH" >> "$GITHUB_OUTPUT"
echo "executable_path=$BINARY_PATH" >> "$GITHUB_OUTPUT"
echo "debug_executable_path=$DEBUG_EXECUTABLE_PATH" >> "$GITHUB_OUTPUT"
echo "packages_dir=$OUT_DIR" >> "$GITHUB_OUTPUT"
echo "bundled_resources_dir=${BUNDLED_RESOURCES_DIR:-}" >> "$GITHUB_OUTPUT"
+236
View File
@@ -0,0 +1,236 @@
#!/usr/bin/env bash
#
# This script configures a complete musl C and C++ toolchain for a Rust target.
# Source this script so it can update the caller's environment.
configure_musl_toolchain() {
local target="${1:-$(uname -m)-unknown-linux-musl}"
local musl_cross_tag="20250929"
local musl_cross_sha256
case "$target" in
aarch64-unknown-linux-musl)
musl_cross_sha256="28a1d26f14f8ddc3aed31f20705fe696777400eb5952d90470a7e6e2dd1175bb"
;;
x86_64-unknown-linux-musl)
musl_cross_sha256="6534870abd7dc327fd2e14cc53972d0552b21f47db5769505534f788537e3544"
;;
*)
echo "Error: unsupported musl target '$target'." >&2
return 1
;;
esac
local compiler_prefix
local musl_cc=""
local musl_cxx=""
local musl_strip=""
for compiler_prefix in "$target" "${target/unknown-/}"; do
if command -v "$compiler_prefix-gcc" &>/dev/null \
&& command -v "$compiler_prefix-g++" &>/dev/null \
&& command -v "$compiler_prefix-strip" &>/dev/null; then
musl_cc="$(command -v "$compiler_prefix-gcc")"
musl_cxx="$(command -v "$compiler_prefix-g++")"
musl_strip="$(command -v "$compiler_prefix-strip")"
break
fi
done
if [[ -z "$musl_cc" && "$target" == "$(uname -m)-unknown-linux-musl" ]] \
&& command -v musl-gcc &>/dev/null \
&& command -v musl-g++ &>/dev/null \
&& command -v strip &>/dev/null; then
musl_cc="$(command -v musl-gcc)"
musl_cxx="$(command -v musl-g++)"
musl_strip="$(command -v strip)"
fi
local default_musl_cross_root
if [[ -z "${WARP_MUSL_CROSS_ROOT:-}" && "${GITHUB_ACTIONS:-}" == "true" && -n "${RUNNER_TEMP:-}" ]]; then
default_musl_cross_root="$RUNNER_TEMP/warp-musl-cross"
elif [[ -n "${HOME:-}" ]]; then
default_musl_cross_root="${XDG_CACHE_HOME:-$HOME/.cache}/warp-musl-cross"
else
default_musl_cross_root="${TMPDIR:-/tmp}/warp-musl-cross-${UID:-$(id -u)}"
fi
local musl_cross_root="${WARP_MUSL_CROSS_ROOT:-$default_musl_cross_root}"
local install_root="$musl_cross_root/$musl_cross_tag"
local toolchain_dir="$install_root/$target"
local toolchain_bin="$toolchain_dir/bin"
local verified_marker="$toolchain_dir/.warp-musl-cross-verified"
local verified_marker_contents="$musl_cross_tag $target $musl_cross_sha256"
ensure_private_cache_dir() {
local dir="$1"
if [[ -L "$dir" ]]; then
echo "Error: musl toolchain cache directory '$dir' must not be a symlink." >&2
return 1
fi
if [[ -e "$dir" && ! -d "$dir" ]]; then
echo "Error: musl toolchain cache path '$dir' exists but is not a directory." >&2
return 1
fi
mkdir -p "$dir" || return 1
chmod 700 "$dir" || return 1
if [[ ! -O "$dir" ]]; then
echo "Error: musl toolchain cache directory '$dir' must be owned by the current user." >&2
return 1
fi
local mode
if mode="$(stat -c '%a' "$dir" 2>/dev/null)"; then
:
elif mode="$(stat -f '%Lp' "$dir" 2>/dev/null)"; then
:
else
echo "Error: could not determine permissions for musl toolchain cache directory '$dir'." >&2
return 1
fi
if (( (8#$mode & 0022) != 0 )); then
echo "Error: musl toolchain cache directory '$dir' must not be writable by group or others." >&2
return 1
fi
}
cached_toolchain_is_verified() {
[[ -r "$verified_marker" ]] && [[ "$(cat "$verified_marker")" == "$verified_marker_contents" ]]
}
if [[ -z "$musl_cc" ]]; then
ensure_private_cache_dir "$musl_cross_root" || return 1
ensure_private_cache_dir "$install_root" || return 1
fi
if [[ -z "$musl_cc" && -L "$toolchain_dir" ]]; then
echo "Error: cached musl toolchain path '$toolchain_dir' must not be a symlink." >&2
return 1
fi
if [[ -z "$musl_cc" ]]; then
if [[ -d "$toolchain_dir" ]] && ! cached_toolchain_is_verified; then
echo "Ignoring unverified cached musl toolchain at '$toolchain_dir'." >&2
fi
if cached_toolchain_is_verified \
&& [[ -x "$toolchain_bin/$target-gcc" ]] \
&& [[ -x "$toolchain_bin/$target-g++" ]] \
&& [[ -x "$toolchain_bin/$target-strip" ]]; then
case ":$PATH:" in
*":$toolchain_bin:"*) ;;
*) export PATH="$toolchain_bin:$PATH" ;;
esac
musl_cc="$(command -v "$target-gcc")"
musl_cxx="$(command -v "$target-g++")"
musl_strip="$(command -v "$target-strip")"
fi
fi
if [[ -z "$musl_cc" ]]; then
if [[ "$(uname -s)" != "Linux" ]]; then
echo "Error: no complete C and C++ toolchain for '$target' was found on PATH." >&2
echo "Automatic musl-cross installation is only supported on Linux." >&2
return 1
fi
if [[ "$(uname -m)" != "x86_64" ]]; then
echo "Error: automatic musl-cross installation is only supported on x86_64 hosts." >&2
return 1
fi
local required_command
for required_command in curl sha256sum tar; do
if ! command -v "$required_command" &>/dev/null; then
echo "Error: '$required_command' is required to install the musl toolchain." >&2
return 1
fi
done
local archive_name="$target.tar.xz"
local archive_url="https://github.com/cross-tools/musl-cross/releases/download/$musl_cross_tag/$archive_name"
if ! (
download_dir=""
cleanup_download() {
if [[ -n "$download_dir" && -d "$download_dir" ]]; then
chmod -R u+w "$download_dir" 2>/dev/null || true
rm -rf "$download_dir"
fi
}
trap cleanup_download EXIT
ensure_private_cache_dir "$musl_cross_root" || exit 1
ensure_private_cache_dir "$install_root" || exit 1
download_dir="$(mktemp -d "$musl_cross_root/.download-$target.XXXXXX")" || exit 1
echo "Downloading the $target C and C++ toolchain to $toolchain_dir"
curl -fsSL --retry 3 "$archive_url" -o "$download_dir/$archive_name" || exit 1
printf '%s %s\n' "$musl_cross_sha256" "$download_dir/$archive_name" | sha256sum -c - || exit 1
tar -xf "$download_dir/$archive_name" -C "$download_dir" || exit 1
if [[ ! -x "$download_dir/$target/bin/$target-gcc" \
|| ! -x "$download_dir/$target/bin/$target-g++" \
|| ! -x "$download_dir/$target/bin/$target-strip" ]]; then
echo "Error: the downloaded archive does not contain the expected C, C++, and strip tools." >&2
exit 1
fi
chmod -R u+w,go-w "$download_dir/$target" || exit 1
printf '%s\n' "$verified_marker_contents" > "$download_dir/$target/.warp-musl-cross-verified" || exit 1
if [[ -x "$toolchain_bin/$target-gcc" \
&& -x "$toolchain_bin/$target-g++" \
&& -x "$toolchain_bin/$target-strip" \
&& -r "$verified_marker" \
&& "$(cat "$verified_marker")" == "$verified_marker_contents" ]]; then
exit 0
fi
if [[ -e "$toolchain_dir" ]]; then
chmod -R u+w "$toolchain_dir" || exit 1
rm -rf "$toolchain_dir" || exit 1
fi
mv "$download_dir/$target" "$toolchain_dir" || exit 1
); then
return 1
fi
case ":$PATH:" in
*":$toolchain_bin:"*) ;;
*) export PATH="$toolchain_bin:$PATH" ;;
esac
musl_cc="$(command -v "$target-gcc")"
musl_cxx="$(command -v "$target-g++")"
musl_strip="$(command -v "$target-strip")"
fi
local tool
for tool in "$musl_cc" "$musl_cxx" "$musl_strip"; do
if ! "$tool" --version &>/dev/null; then
echo "Error: musl tool '$tool' cannot execute on this host." >&2
return 1
fi
done
local target_env="${target//-/_}"
local cargo_target_env
cargo_target_env="$(printf '%s' "$target" | tr '[:lower:]-' '[:upper:]_')"
export "CC_$target_env=$musl_cc"
export "CXX_$target_env=$musl_cxx"
export "CARGO_TARGET_${cargo_target_env}_LINKER=$musl_cc"
export WARP_MUSL_TARGET="$target"
export WARP_MUSL_CC="$musl_cc"
export WARP_MUSL_CXX="$musl_cxx"
export WARP_MUSL_STRIP="$musl_strip"
echo "Configured the $target toolchain with $musl_cc, $musl_cxx, and $musl_strip"
}
if [[ -n "${BASH_VERSION:-}" && "${BASH_SOURCE[0]}" == "$0" ]]; then
echo "Error: source this script so it can configure the caller's environment." >&2
exit 1
fi
if [[ -n "${ZSH_VERSION:-}" && "${ZSH_EVAL_CONTEXT:-}" != *:file ]]; then
echo "Error: source this script so it can configure the caller's environment." >&2
exit 1
fi
configure_musl_toolchain "$@"
+12 -2
View File
@@ -4,6 +4,8 @@
set -e
. "$PWD/script/warp_sudo"
# Define some control sequences for text formatting.
red="\033[0;31m"
reset="\033[0m"
@@ -33,8 +35,16 @@ if [[ "$(source /etc/os-release; echo $ID $ID_LIKE)" = *"debian"* ]]; then
brotli
# Needed for voice input
libasound2-dev
# Needed by bindgen (used by minimp4-sys, pulled in by warpui_core's
# integration_tests feature) — pulls in libclang-common-*-dev which
# provides clang's resource-dir builtin headers.
libclang-dev
# Required by script/presubmit's clang-format check on C/C++/Obj-C sources.
clang-format
# Required to build statically-linked binaries for Linux.
musl-tools
)
sudo apt-get install -y "${PACKAGES[@]}"
warp_sudo apt-get install -y "${PACKAGES[@]}"
# Install a modern version of protoc. The apt 'protobuf-compiler' package on
# Ubuntu 20.04 ships protoc 3.6.1, which is too old for proto3 'optional'
@@ -47,7 +57,7 @@ if [[ "$(source /etc/os-release; echo $ID $ID_LIKE)" = *"debian"* ]]; then
esac
curl -fsSL -o /tmp/protoc.zip \
"https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"
sudo unzip -o /tmp/protoc.zip -d /usr/local bin/protoc 'include/*'
warp_sudo unzip -o /tmp/protoc.zip -d /usr/local bin/protoc 'include/*'
rm /tmp/protoc.zip
else
echo -e "⚠️ ${red}Unknown Linux distribution; necessary build dependencies may not be installed!${reset}"
+3 -1
View File
@@ -4,6 +4,8 @@
set -e
. "$PWD/script/warp_sudo"
# Define some control sequences for text formatting.
red="\033[0;31m"
reset="\033[0m"
@@ -34,7 +36,7 @@ if [[ "$(source /etc/os-release; echo $ID $ID_LIKE)" = *"debian"* ]]; then
# Ensuring at least one cursor library for WSL.
yaru-theme-icon
)
sudo apt-get install -y "${PACKAGES[@]}"
warp_sudo apt-get install -y "${PACKAGES[@]}"
else
echo -e "⚠️ ${red}Unknown Linux distribution; necessary runtime dependencies may not be installed!${reset}"
fi
+7 -5
View File
@@ -4,6 +4,8 @@
set -e
. "$PWD/script/warp_sudo"
# Define some control sequences for text formatting.
red="\033[0;31m"
reset="\033[0m"
@@ -23,15 +25,15 @@ if [[ "$(source /etc/os-release; echo $ID $ID_LIKE)" = *"debian"* ]]; then
# We run vim in some integration tests to test the altscreen.
vim
)
sudo apt-get install -y "${PACKAGES[@]}"
warp_sudo apt-get install -y "${PACKAGES[@]}"
# If gcloud is not already installed, install it so that we can run SSH integration tests.
if [[ ! -x "$(command -v gcloud)" ]]; then
echo "⬇️ Installing the gcloud CLI..."
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
curl -f https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update -y
sudo apt-get install google-cloud-cli -y
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | warp_sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | warp_sudo gpg --dearmor --yes -o /usr/share/keyrings/cloud.google.gpg
warp_sudo apt-get update -y
warp_sudo apt-get install google-cloud-cli -y
fi
else
echo -e "⚠️ ${red}Unknown Linux distribution; necessary test dependencies may not be installed!${reset}"
+80
View File
@@ -0,0 +1,80 @@
#!/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"
cat > "$temp_dir/bin/rustup" <<'EOF'
#!/usr/bin/env bash
exit 0
EOF
chmod +x "$temp_dir/bin/rustup"
case "$(uname -m)" in
arm64|aarch64)
arch="aarch64"
;;
x86_64|amd64)
arch="x86_64"
;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac
target="$arch-unknown-linux-musl"
for compiler in "$target-gcc" "$target-g++" "$target-strip"; do
cat > "$temp_dir/bin/$compiler" <<'EOF'
#!/usr/bin/env bash
exit 0
EOF
chmod +x "$temp_dir/bin/$compiler"
done
PATH="$temp_dir/bin:$PATH" \
CARGO_ARGS_FILE="$temp_dir/cargo-args" \
CARGO_TARGET_DIR="$temp_dir/target" \
"$workspace_root/script/linux/bundle" \
--check-only \
--artifact warpctrl \
--arch "$arch" \
--features smoke_feature
grep -qx -- '--features' "$temp_dir/cargo-args"
grep -qx -- 'release_bundle,crash_reporting,agent_mode_debug,jemalloc_pprof,heap_usage_tracking,standalone,warp_control_cli,smoke_feature' "$temp_dir/cargo-args"
profile_dir="$temp_dir/target/$target/release-cli-debug_assertions"
mkdir -p "$profile_dir"
cat > "$profile_dir/dev" <<'EOF'
#!/usr/bin/env bash
printf '%s\n' "$@" > "$FORWARDED_ARGS_FILE"
EOF
chmod +x "$profile_dir/dev"
PATH="$temp_dir/bin:$PATH" \
CARGO_TARGET_DIR="$temp_dir/target" \
NO_LICENSES=1 \
SKIP_SETTINGS_SCHEMA=1 \
"$workspace_root/script/linux/bundle" \
--skip-build \
--artifact warpctrl \
--arch "$arch"
FORWARDED_ARGS_FILE="$temp_dir/forwarded-args" \
"$profile_dir/bundle/linux/warpctrl" tab create --instance "inst 123"
cat > "$temp_dir/expected-forwarded-args" <<'EOF'
--warpctrl
tab
create
--instance
inst 123
EOF
cmp "$temp_dir/expected-forwarded-args" "$temp_dir/forwarded-args"