Unverified Commit 5fad47f7 authored by Ryan McCormick's avatar Ryan McCormick Committed by GitHub
Browse files

fix: Reduce disk space usage in pre-merge-rust action (removes unnecessary...

fix: Reduce disk space usage in pre-merge-rust action (removes unnecessary sccache artifacts) (#2337)
parent 784da90e
......@@ -41,8 +41,6 @@ jobs:
matrix: { dir: ['.', 'lib/bindings/python', 'lib/runtime/examples'] }
permissions:
contents: read
env:
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4
- name: Set up system dependencies
......@@ -50,13 +48,20 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler
- name: Cache sccache artifacts
uses: actions/cache@v4
with:
path: ~/.cache/sccache/
key: ${{ runner.os }}-sccache-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-sccache-${{ matrix.dir }}-
- name: Free runner disk space
run: |
echo "Disk space before:"
df -h
rm -rf \
/host_usr/share/dotnet /host_usr/local/lib/android /opt/ghc \
/host_usr/local/share/powershell /host_usr/share/swift /host_usr/local/.ghcup \
/host_usr/lib/jvm /opt/hostedtoolcache
echo "Disk space after:"
df -h
# TODO: Caching target/ dir handles most of the build caching improvements
# currently, so sccache artifacts are mostly duplicates wasting disk space.
# Revisit this to see if sccache can improve current caching behavior.
# TODO: Consider single target/ directory for all subdirectories/crates instead.
- name: Cache cargo artifacts
uses: actions/cache@v4
......@@ -70,15 +75,6 @@ jobs:
key: ${{ runner.os }}-cargo-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ matrix.dir }}-
- name: Install sccache
run: |
SCCACHE_VERSION="0.10.0"
SCCACHE_FILE="sccache-v${SCCACHE_VERSION}-$(uname -m)-unknown-linux-musl"
SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/${SCCACHE_FILE}.tar.gz"
curl -L "${SCCACHE_URL}" | tar xz
mv ${SCCACHE_FILE}/sccache /usr/local/bin/sccache
chmod +x /usr/local/bin/sccache
- name: Install Rust in dev environment
# Install Rust only to run GitHub Local Actions in (dev environment) using the `ACT` environment variable.
# See act usage: https://nektosact.com/introduction.html
......@@ -112,7 +108,3 @@ jobs:
working-directory: ${{ matrix.dir }}
# NOTE: --all-targets doesn't run doc tests
run: cargo test --locked --all-targets
- name: Run sccache stat for check
shell: bash
run: sccache --show-stats
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment