From a23cd6851438588190880add8b26a064ce9f5d99 Mon Sep 17 00:00:00 2001 From: Zach LaVallee Date: Tue, 10 Mar 2026 16:09:20 -0700 Subject: [PATCH 1/2] Fix ARM Rust cache: use workspace-relative CARGO_HOME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ARM build installs Rust inside a Docker container, but the Swatinem/rust-cache action runs on the host — so the cache was never hitting. Move CARGO_HOME and RUSTUP_HOME to workspace-relative paths (.rust/) and cache them with actions/cache, which sees the same filesystem as the container mount. Skip rustup install when cargo already exists from a cache restore. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/build-all.yml | 22 ++++++++++++++++++---- .github/workflows/scripts/build-arm.sh | 15 ++++++++++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index a214bc77bf..876a5aac78 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -75,8 +75,8 @@ jobs: # Set up Rust. # This action installs the 'minimal' profile. - # Even on Linux ARM this is necessary because rust-cache uses it. - uses: dtolnay/rust-toolchain@stable + if: ${{ matrix.os != 'LinuxARM' }} - name: Install additional Rust tooling if: ${{ matrix.os != 'LinuxARM' }} @@ -84,12 +84,26 @@ jobs: with: tool: nextest + # Rust cache for non-ARM platforms (runs cargo on the host). - uses: Swatinem/rust-cache@v2 + if: ${{ matrix.os != 'LinuxARM' }} with: prefix-key: ${{ matrix.os }} - # The home directory inside containers is different than the one outside of them. - # LinuxARM needs this for its caching to work inside haskell-static-alpine. - cache-directories: ${{ runner.temp }}/_github_home/.cargo + + # ARM Rust cache: build-arm.sh installs Rust inside a Docker container, + # so Swatinem/rust-cache (which runs on the host) can't help. Instead, + # cache the workspace-relative .rust/ and target/ dirs that build-arm.sh + # writes to via CARGO_HOME/RUSTUP_HOME. + - uses: actions/cache@v4 + if: ${{ matrix.os == 'LinuxARM' }} + name: Cache ARM Rust toolchain and build + with: + path: | + .rust/ + target/ + key: ${{ matrix.os-name }}-rust-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ matrix.os-name }}-rust- - name: Debugging information run: | diff --git a/.github/workflows/scripts/build-arm.sh b/.github/workflows/scripts/build-arm.sh index 0fdc5a218c..8a688f5608 100755 --- a/.github/workflows/scripts/build-arm.sh +++ b/.github/workflows/scripts/build-arm.sh @@ -12,9 +12,18 @@ RUNNER_OS=$1 PROJECT_FILE=$2 FEATURES=$3 -# Install rust tooling -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal -. "/home/runner/.cargo/env" +# Use workspace-relative paths so the GitHub Actions cache (which runs on the +# host) can restore/save the Rust toolchain and build artifacts. Without this, +# rustup installs to /home/runner/.cargo inside the container, which the host +# cache action never sees — causing a full reinstall on every run. +export CARGO_HOME="${GITHUB_WORKSPACE}/.rust/cargo" +export RUSTUP_HOME="${GITHUB_WORKSPACE}/.rust/rustup" +export PATH="${CARGO_HOME}/bin:${PATH}" + +# Install Rust only if not restored from cache. +if ! command -v cargo > /dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal +fi rustc -V cargo -V From acf9eb569490e2d931abf06e782293d7aa75e764 Mon Sep 17 00:00:00 2001 From: Zach LaVallee Date: Tue, 10 Mar 2026 17:08:22 -0700 Subject: [PATCH 2/2] Trigger CI to test warm ARM Rust cache Co-Authored-By: Claude Opus 4.6