cringe
Some checks are pending
CI / agent (push) Waiting to run
CI / backend (push) Waiting to run
CI / frontend (push) Waiting to run
CI / containers (push) Waiting to run

This commit is contained in:
2026-09-20 11:03:09 +03:00
parent c4dc19cd41
commit cf1c31eb2a
6 changed files with 194 additions and 28 deletions

39
scripts/build-agent-native.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
readonly REPOSITORY_ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
readonly OUTPUT_DIRECTORY="${1:-$REPOSITORY_ROOT/dist}"
[[ "$(uname -s)" == Linux ]] || {
printf 'error: the agent must be built on Linux; macOS produces a Mach-O binary, not a Linux ELF binary\n' >&2
exit 1
}
case "$(uname -m)" in
x86_64|amd64)
RELEASE_ARCHITECTURE="amd64"
;;
aarch64|arm64)
RELEASE_ARCHITECTURE="arm64"
;;
*)
printf 'error: unsupported build architecture: %s\n' "$(uname -m)" >&2
exit 1
;;
esac
command -v cargo >/dev/null || { printf 'error: cargo is required\n' >&2; exit 1; }
cargo build \
--manifest-path "$REPOSITORY_ROOT/agent/Cargo.toml" \
--release \
--locked
"$SCRIPT_DIR/package-agent-release.sh" \
--output "$OUTPUT_DIRECTORY" \
"--$RELEASE_ARCHITECTURE" "$REPOSITORY_ROOT/agent/target/release/vps-agent"
printf 'release artifact prepared in %s for linux/%s\n' \
"$OUTPUT_DIRECTORY" "$RELEASE_ARCHITECTURE"