Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/ci/docker/scripts/sccache.sh

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could write this script as this:

#!/bin/sh

# ignore-tidy-linelength

set -ex

arch="$(uname -m)"
case "${arch}" in
    x86_64|aarch64)
        ;;
    *)
        echo "unsupported architecture: ${arch}"
        exit 1
esac

curl -fo sccache.tar.gz \
    "https://ci-mirrors.rust-lang.org/rustc/2026-06-19-sccache-v0.16.0-${arch}-unknown-linux-musl.tar.gz"
tar -xvf sccache.tar.gz --strip-components 1 \
    "sccache-v0.16.0-${arch}-unknown-linux-musl/sccache"
rm sccache.tar.gz
mv sccache /usr/local/bin/sccache
chmod +x /usr/local/bin/sccache

Improvements:

  • refactor the case so that it is simpler
  • remove the archive after using it
  • only extract the binary

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ set -ex

case "$(uname -m)" in
x86_64)
url="https://ci-mirrors.rust-lang.org/rustc/2025-02-24-sccache-v0.10.0-x86_64-unknown-linux-musl"
url="https://ci-mirrors.rust-lang.org/rustc/2026-06-19-sccache-v0.16.0-x86_64-unknown-linux-musl.tar.gz"
;;
aarch64)
url="https://ci-mirrors.rust-lang.org/rustc/2025-02-24-sccache-v0.10.0-aarch64-unknown-linux-musl"
url="https://ci-mirrors.rust-lang.org/rustc/2026-06-19-sccache-v0.16.0-aarch64-unknown-linux-musl.tar.gz"
;;
*)
echo "unsupported architecture: $(uname -m)"
exit 1
esac

curl -fo /usr/local/bin/sccache "${url}"
curl -fo sccache.tar.gz "${url}"
tar -xvf sccache.tar.gz --strip-components 1
mv sccache /usr/local/bin/sccache
chmod +x /usr/local/bin/sccache
17 changes: 13 additions & 4 deletions src/ci/scripts/install-sccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ IFS=$'\n\t'

source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

# Note that this script is executed **inside** the source directory.
# So take care not to extract stuff into it that could perturb the build or the distributed
# source tarballs.

if isMacOS; then
curl -fo /usr/local/bin/sccache \
"${MIRRORS_BASE}/2025-02-24-sccache-v0.10.0-x86_64-apple-darwin"
mkdir -p sccache
cd sccache
curl -fo sccache.tar.gz \
"${MIRRORS_BASE}/2026-06-19-sccache-v0.16.0-x86_64-apple-darwin.tar.gz"
tar -xvf sccache.tar.gz --strip-components 1
Comment thread
Kobzol marked this conversation as resolved.
Resolved
mv sccache /usr/local/bin/sccache
Comment thread
Kobzol marked this conversation as resolved.
Resolved
chmod +x /usr/local/bin/sccache
elif isWindows; then
mkdir -p sccache
curl -fo sccache/sccache.exe \
"${MIRRORS_BASE}/2025-02-24-sccache-v0.10.0-x86_64-pc-windows-msvc.exe"
curl -fo sccache/sccache.zip \
"${MIRRORS_BASE}/2026-06-19-sccache-v0.16.0-x86_64-pc-windows-msvc.zip"
unzip -j sccache/sccache.zip sccache-v0.16.0-x86_64-pc-windows-msvc/sccache.exe -d sccache
Comment thread
Kobzol marked this conversation as resolved.
Resolved
ciCommandAddPath "$(cygpath -m "$(pwd)/sccache")"
fi

Expand Down
Loading