Skip to content

Commit 5fad47f

Browse files
authored
fix: Reduce disk space usage in pre-merge-rust action (removes unnecessary sccache artifacts) (#2337)
1 parent 784da90 commit 5fad47f

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

.github/workflows/pre-merge-rust.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,27 @@ jobs:
4141
matrix: { dir: ['.', 'lib/bindings/python', 'lib/runtime/examples'] }
4242
permissions:
4343
contents: read
44-
env:
45-
RUSTC_WRAPPER: "sccache"
4644
steps:
4745
- uses: actions/checkout@v4
4846
- name: Set up system dependencies
4947
run: |
5048
sudo apt-get update -y
5149
sudo apt-get install -y protobuf-compiler
5250
53-
- name: Cache sccache artifacts
54-
uses: actions/cache@v4
55-
with:
56-
path: ~/.cache/sccache/
57-
key: ${{ runner.os }}-sccache-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }}
58-
restore-keys: ${{ runner.os }}-sccache-${{ matrix.dir }}-
51+
- name: Free runner disk space
52+
run: |
53+
echo "Disk space before:"
54+
df -h
55+
rm -rf \
56+
/host_usr/share/dotnet /host_usr/local/lib/android /opt/ghc \
57+
/host_usr/local/share/powershell /host_usr/share/swift /host_usr/local/.ghcup \
58+
/host_usr/lib/jvm /opt/hostedtoolcache
59+
echo "Disk space after:"
60+
df -h
5961
62+
# TODO: Caching target/ dir handles most of the build caching improvements
63+
# currently, so sccache artifacts are mostly duplicates wasting disk space.
64+
# Revisit this to see if sccache can improve current caching behavior.
6065
# TODO: Consider single target/ directory for all subdirectories/crates instead.
6166
- name: Cache cargo artifacts
6267
uses: actions/cache@v4
@@ -70,15 +75,6 @@ jobs:
7075
key: ${{ runner.os }}-cargo-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }}
7176
restore-keys: ${{ runner.os }}-cargo-${{ matrix.dir }}-
7277

73-
- name: Install sccache
74-
run: |
75-
SCCACHE_VERSION="0.10.0"
76-
SCCACHE_FILE="sccache-v${SCCACHE_VERSION}-$(uname -m)-unknown-linux-musl"
77-
SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/${SCCACHE_FILE}.tar.gz"
78-
curl -L "${SCCACHE_URL}" | tar xz
79-
mv ${SCCACHE_FILE}/sccache /usr/local/bin/sccache
80-
chmod +x /usr/local/bin/sccache
81-
8278
- name: Install Rust in dev environment
8379
# Install Rust only to run GitHub Local Actions in (dev environment) using the `ACT` environment variable.
8480
# See act usage: https://nektosact.com/introduction.html
@@ -112,7 +108,3 @@ jobs:
112108
working-directory: ${{ matrix.dir }}
113109
# NOTE: --all-targets doesn't run doc tests
114110
run: cargo test --locked --all-targets
115-
116-
- name: Run sccache stat for check
117-
shell: bash
118-
run: sccache --show-stats

0 commit comments

Comments
 (0)