[CI][NPU] use internal HTTP cache for Rust toolchain via RUSTUP_CACHE (#24801)
This commit is contained in:
@@ -103,8 +103,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
@@ -157,8 +156,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
@@ -207,8 +205,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
@@ -258,8 +255,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
@@ -306,8 +302,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
@@ -365,8 +360,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
@@ -424,8 +418,7 @@ jobs:
|
||||
PYPI_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
|
||||
GITHUB_PROXY_URL: "https://gh-proxy.test.osinfra.cn/"
|
||||
RUSTUP_DIST_SERVER: "https://rsproxy.cn"
|
||||
RUSTUP_UPDATE_ROOT: "https://rsproxy.cn/rustup"
|
||||
RUSTUP_CACHE_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local:8082"
|
||||
run: |
|
||||
# speed up by using infra cache services
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
# setuptools-rust. Minimum supported version is 1.85 (edition 2024).
|
||||
set -euxo pipefail
|
||||
|
||||
# Pick up cargo if rustup was installed in a previous CI step.
|
||||
# Make cargo/rustc visible to the rest of this shell and to subsequent
|
||||
# GitHub Actions steps in the same job.
|
||||
export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:${PATH}"
|
||||
if [ -n "${GITHUB_PATH:-}" ]; then
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "${GITHUB_PATH}"
|
||||
fi
|
||||
|
||||
if command -v cargo >/dev/null 2>&1 && command -v rustc >/dev/null 2>&1; then
|
||||
echo "rust already installed: $(rustc --version), $(cargo --version)"
|
||||
@@ -27,14 +31,25 @@ if ! command -v curl >/dev/null 2>&1; then
|
||||
fi
|
||||
fi
|
||||
|
||||
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 2 -sSf https://sh.rustup.rs \
|
||||
| sh -s -- -y --no-modify-path
|
||||
|
||||
# Make cargo/rustc visible to the rest of this shell and to subsequent
|
||||
# GitHub Actions steps in the same job.
|
||||
export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:${PATH}"
|
||||
if [ -n "${GITHUB_PATH:-}" ]; then
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> "${GITHUB_PATH}"
|
||||
if [ -n "${RUSTUP_CACHE_URL:-}" ]; then
|
||||
# An in-cluster HTTP mirror is available (e.g. on NPU runners).
|
||||
export RUSTUP_DIST_SERVER="${RUSTUP_CACHE_URL}/rustup"
|
||||
export RUSTUP_UPDATE_ROOT="${RUSTUP_CACHE_URL}/rustup/rustup"
|
||||
case "$(uname -m)" in
|
||||
x86_64) RUSTUP_ARCH="x86_64-unknown-linux-gnu" ;;
|
||||
aarch64) RUSTUP_ARCH="aarch64-unknown-linux-gnu" ;;
|
||||
*) echo "ERROR: unsupported arch $(uname -m)"; exit 1 ;;
|
||||
esac
|
||||
RUSTUP_TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "${RUSTUP_TMP}"' EXIT
|
||||
curl --retry 3 --retry-delay 2 -sSfL \
|
||||
"${RUSTUP_UPDATE_ROOT}/dist/${RUSTUP_ARCH}/rustup-init" \
|
||||
-o "${RUSTUP_TMP}/rustup-init"
|
||||
chmod +x "${RUSTUP_TMP}/rustup-init"
|
||||
"${RUSTUP_TMP}/rustup-init" -y --no-modify-path
|
||||
else
|
||||
curl --proto '=https' --tlsv1.2 --retry 3 --retry-delay 2 -sSf https://sh.rustup.rs \
|
||||
| sh -s -- -y --no-modify-path
|
||||
fi
|
||||
|
||||
rustc --version
|
||||
|
||||
Reference in New Issue
Block a user