fix(ci): sccache wrapper + incremental=false for correct caching
Some checks failed
BotServer CI / build (push) Failing after 23s
Some checks failed
BotServer CI / build (push) Failing after 23s
- Add sccache wrapper that unsets CARGO_INCREMENTAL (sccache 0.14.0 refuses to work when that env var is present, even if =0) - Remove rustc-wrapper from .cargo/config.toml (use RUSTC_WRAPPER env in CI) - Set [profile.dev] incremental = false to avoid sccache 'prohibited' error - DEV-DEPENDENCIES.sh now installs sccache 0.14.0 + wrapper correctly - CI workflow: unset CARGO_INCREMENTAL env (let sccache wrapper handle it) Tested on alm-ci: 50% cache hit rate on rebuild after target/ removal.
This commit is contained in:
parent
5d9b88018f
commit
0e260c9927
4 changed files with 17 additions and 15 deletions
|
|
@ -1,5 +1,4 @@
|
|||
[build]
|
||||
rustc-wrapper = "sccache"
|
||||
jobs = 6
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ jobs:
|
|||
runs-on: gbo
|
||||
env:
|
||||
RUSTC_WRAPPER: sccache
|
||||
CARGO_INCREMENTAL: "1"
|
||||
PATH: "/home/gbuser/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin"
|
||||
steps:
|
||||
- name: Setup
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ opt-level = "s"
|
|||
|
||||
[profile.dev]
|
||||
debug = 1
|
||||
incremental = true
|
||||
incremental = false
|
||||
codegen-units = 32
|
||||
opt-level = 0
|
||||
|
||||
|
|
|
|||
|
|
@ -33,16 +33,23 @@ install_sccache() {
|
|||
fi
|
||||
if [ "$CURRENT_VER" = "$WANT_VER" ]; then
|
||||
echo "sccache $WANT_VER already installed"
|
||||
return
|
||||
else
|
||||
echo "Upgrading sccache from ${CURRENT_VER:-none} to $WANT_VER..."
|
||||
rm -f /usr/local/bin/sccache /usr/local/bin/sccache-dist
|
||||
ARCH=$(uname -m)
|
||||
curl -L "https://github.com/mozilla/sccache/releases/download/v${WANT_VER}/sccache-v${WANT_VER}-${ARCH}-unknown-linux-musl.tar.gz" -o /tmp/sccache.tar.gz
|
||||
tar -xzf /tmp/sccache.tar.gz -C /tmp
|
||||
cp "/tmp/sccache-v${WANT_VER}-${ARCH}-unknown-linux-musl/sccache" /usr/local/bin/sccache.real
|
||||
chmod +x /usr/local/bin/sccache.real
|
||||
rm -rf /tmp/sccache*
|
||||
fi
|
||||
echo "Upgrading sccache from ${CURRENT_VER:-none} to $WANT_VER..."
|
||||
rm -f /usr/local/bin/sccache /usr/local/bin/sccache-dist
|
||||
ARCH=$(uname -m)
|
||||
curl -L "https://github.com/mozilla/sccache/releases/download/v${WANT_VER}/sccache-v${WANT_VER}-${ARCH}-unknown-linux-musl.tar.gz" -o /tmp/sccache.tar.gz
|
||||
tar -xzf /tmp/sccache.tar.gz -C /tmp
|
||||
cp "/tmp/sccache-v${WANT_VER}-${ARCH}-unknown-linux-musl/sccache" /usr/local/bin/sccache
|
||||
# Install wrapper that unsets CARGO_INCREMENTAL before calling sccache.real
|
||||
cat > /usr/local/bin/sccache << 'EOF'
|
||||
#!/bin/bash
|
||||
unset CARGO_INCREMENTAL
|
||||
exec /usr/local/bin/sccache.real "$@"
|
||||
EOF
|
||||
chmod +x /usr/local/bin/sccache
|
||||
rm -rf /tmp/sccache*
|
||||
sccache --version
|
||||
}
|
||||
|
||||
|
|
@ -77,11 +84,8 @@ jobs = -1
|
|||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||
|
||||
[env]
|
||||
RUSTC_WRAPPER = "sccache"
|
||||
CARGOCONF
|
||||
echo "Created .cargo/config.toml with mold + sccache"
|
||||
echo "Created .cargo/config.toml with mold"
|
||||
else
|
||||
echo ".cargo/config.toml already exists, skipping"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue