ci: consolidate rust + protoc install across workflows (#23700)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
b3ead32d3c
commit
c3ab5bec7d
@@ -18,7 +18,7 @@ ARCH=$(uname -m)
|
||||
if command -v apt-get &> /dev/null; then
|
||||
# Ubuntu/Debian
|
||||
apt-get update || true # May fail due to unrelated broken packages
|
||||
PROTOC_APT_PACKAGES=(wget unzip gcc g++ perl make)
|
||||
PROTOC_APT_PACKAGES=(wget unzip)
|
||||
apt-get install -y --no-install-recommends "${PROTOC_APT_PACKAGES[@]}" || {
|
||||
echo "Warning: apt-get install failed, checking if required packages are available..."
|
||||
for pkg in "${PROTOC_APT_PACKAGES[@]}"; do
|
||||
@@ -32,9 +32,9 @@ if command -v apt-get &> /dev/null; then
|
||||
elif command -v yum &> /dev/null; then
|
||||
# RHEL/CentOS
|
||||
yum update -y
|
||||
yum install -y wget unzip gcc gcc-c++ perl-core make
|
||||
yum install -y wget unzip
|
||||
else
|
||||
echo "ERROR: Neither apt-get nor yum found; cannot install protoc build deps"
|
||||
echo "ERROR: Neither apt-get nor yum found; cannot install protoc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# Install protoc and a Rust toolchain (rustup/cargo). Required by setuptools-rust
|
||||
# to build the bundled native gRPC extension (rust/sglang-grpc) when installing
|
||||
# the main `sglang` wheel from source. Idempotent — both helpers no-op if
|
||||
# already installed.
|
||||
#
|
||||
# protoc installs system-wide (/usr/local) and apt deps, so it needs root.
|
||||
# rustup installs per-user under $HOME/.cargo, so it must run as the calling
|
||||
# user (running it under sudo would put cargo in /root/.cargo and the rest of
|
||||
# the job wouldn't find it).
|
||||
set -euxo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
SUDO=""
|
||||
elif command -v sudo >/dev/null 2>&1; then
|
||||
SUDO="sudo"
|
||||
else
|
||||
SUDO=""
|
||||
fi
|
||||
|
||||
${SUDO} bash "${SCRIPT_DIR}/install_protoc.sh"
|
||||
bash "${SCRIPT_DIR}/install_rustup.sh"
|
||||
Reference in New Issue
Block a user