Install sccache during server provision
This commit is contained in:
@@ -139,6 +139,41 @@ pipeline {
|
||||
fi
|
||||
}
|
||||
|
||||
install_sccache() {
|
||||
for tool_dir in "${HOME:-}/.cargo/bin" /root/.cargo/bin /usr/local/cargo/bin; do
|
||||
if [[ -d "${tool_dir}" && ":${PATH}:" != *":${tool_dir}:"* ]]; then
|
||||
export PATH="${tool_dir}:${PATH}"
|
||||
fi
|
||||
done
|
||||
|
||||
if command -v sccache >/dev/null 2>&1; then
|
||||
echo "[server-provision] sccache 已存在: $(command -v sccache)"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -x /root/.cargo/bin/sccache ]]; then
|
||||
echo "[server-provision] sccache 已存在: /root/.cargo/bin/sccache"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "[server-provision] 未找到 sccache,准备通过 cargo install sccache 安装。"
|
||||
if ! command -v cargo >/dev/null 2>&1; then
|
||||
echo "[server-provision] 未找到 cargo,无法自动安装 sccache。请先安装 Rust 工具链后重跑 Server-Provision。" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${DRY_RUN}" == "true" ]]; then
|
||||
echo "+ cargo install sccache --locked"
|
||||
return
|
||||
fi
|
||||
|
||||
cargo install sccache --locked
|
||||
if ! command -v sccache >/dev/null 2>&1 && [[ ! -x /root/.cargo/bin/sccache ]]; then
|
||||
echo "[server-provision] sccache 安装后仍不可用,请检查 cargo bin 目录是否在 PATH 中。" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
render_nginx_https_config() {
|
||||
sed "s/genarrative.example.com/${SERVER_NAME}/g" deploy/nginx/genarrative.conf
|
||||
}
|
||||
@@ -302,6 +337,7 @@ pipeline {
|
||||
|
||||
run_cmd id
|
||||
install_build_dependencies
|
||||
install_sccache
|
||||
run_cmd mkdir -p "${SPACETIME_ROOT}" "${RELEASE_ROOT}" "$(dirname "${CURRENT_LINK}")" "$(dirname "${WEB_LINK}")" /etc/genarrative /var/lib/genarrative/maintenance /var/lib/genarrative/auth
|
||||
|
||||
if ! id spacetimedb >/dev/null 2>&1; then
|
||||
|
||||
Reference in New Issue
Block a user