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: ...@@ -41,8 +41,6 @@ jobs:
matrix: { dir: ['.', 'lib/bindings/python', 'lib/runtime/examples'] } matrix: { dir: ['.', 'lib/bindings/python', 'lib/runtime/examples'] }
permissions: permissions:
contents: read contents: read
env:
RUSTC_WRAPPER: "sccache"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up system dependencies - name: Set up system dependencies
...@@ -50,13 +48,20 @@ jobs: ...@@ -50,13 +48,20 @@ jobs:
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install -y protobuf-compiler sudo apt-get install -y protobuf-compiler
- name: Cache sccache artifacts - name: Free runner disk space
uses: actions/cache@v4 run: |
with: echo "Disk space before:"
path: ~/.cache/sccache/ df -h
key: ${{ runner.os }}-sccache-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }} rm -rf \
restore-keys: ${{ runner.os }}-sccache-${{ matrix.dir }}- /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. # TODO: Consider single target/ directory for all subdirectories/crates instead.
- name: Cache cargo artifacts - name: Cache cargo artifacts
uses: actions/cache@v4 uses: actions/cache@v4
...@@ -70,15 +75,6 @@ jobs: ...@@ -70,15 +75,6 @@ jobs:
key: ${{ runner.os }}-cargo-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ matrix.dir }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ matrix.dir }}- 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 - name: Install Rust in dev environment
# Install Rust only to run GitHub Local Actions in (dev environment) using the `ACT` environment variable. # Install Rust only to run GitHub Local Actions in (dev environment) using the `ACT` environment variable.
# See act usage: https://nektosact.com/introduction.html # See act usage: https://nektosact.com/introduction.html
...@@ -112,7 +108,3 @@ jobs: ...@@ -112,7 +108,3 @@ jobs:
working-directory: ${{ matrix.dir }} working-directory: ${{ matrix.dir }}
# NOTE: --all-targets doesn't run doc tests # NOTE: --all-targets doesn't run doc tests
run: cargo test --locked --all-targets 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