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]
|
[build]
|
||||||
rustc-wrapper = "sccache"
|
|
||||||
jobs = 6
|
jobs = 6
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-gnu]
|
[target.x86_64-unknown-linux-gnu]
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ jobs:
|
||||||
runs-on: gbo
|
runs-on: gbo
|
||||||
env:
|
env:
|
||||||
RUSTC_WRAPPER: sccache
|
RUSTC_WRAPPER: sccache
|
||||||
CARGO_INCREMENTAL: "1"
|
|
||||||
PATH: "/home/gbuser/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin"
|
PATH: "/home/gbuser/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin"
|
||||||
steps:
|
steps:
|
||||||
- name: Setup
|
- name: Setup
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ opt-level = "s"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = 1
|
debug = 1
|
||||||
incremental = true
|
incremental = false
|
||||||
codegen-units = 32
|
codegen-units = 32
|
||||||
opt-level = 0
|
opt-level = 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,23 @@ install_sccache() {
|
||||||
fi
|
fi
|
||||||
if [ "$CURRENT_VER" = "$WANT_VER" ]; then
|
if [ "$CURRENT_VER" = "$WANT_VER" ]; then
|
||||||
echo "sccache $WANT_VER already installed"
|
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
|
fi
|
||||||
echo "Upgrading sccache from ${CURRENT_VER:-none} to $WANT_VER..."
|
# Install wrapper that unsets CARGO_INCREMENTAL before calling sccache.real
|
||||||
rm -f /usr/local/bin/sccache /usr/local/bin/sccache-dist
|
cat > /usr/local/bin/sccache << 'EOF'
|
||||||
ARCH=$(uname -m)
|
#!/bin/bash
|
||||||
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
|
unset CARGO_INCREMENTAL
|
||||||
tar -xzf /tmp/sccache.tar.gz -C /tmp
|
exec /usr/local/bin/sccache.real "$@"
|
||||||
cp "/tmp/sccache-v${WANT_VER}-${ARCH}-unknown-linux-musl/sccache" /usr/local/bin/sccache
|
EOF
|
||||||
chmod +x /usr/local/bin/sccache
|
chmod +x /usr/local/bin/sccache
|
||||||
rm -rf /tmp/sccache*
|
|
||||||
sccache --version
|
sccache --version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,11 +84,8 @@ jobs = -1
|
||||||
[target.x86_64-unknown-linux-gnu]
|
[target.x86_64-unknown-linux-gnu]
|
||||||
linker = "clang"
|
linker = "clang"
|
||||||
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||||
|
|
||||||
[env]
|
|
||||||
RUSTC_WRAPPER = "sccache"
|
|
||||||
CARGOCONF
|
CARGOCONF
|
||||||
echo "Created .cargo/config.toml with mold + sccache"
|
echo "Created .cargo/config.toml with mold"
|
||||||
else
|
else
|
||||||
echo ".cargo/config.toml already exists, skipping"
|
echo ".cargo/config.toml already exists, skipping"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue