From a4cd64acc556019b5e9a9593231497f53db56c69 Mon Sep 17 00:00:00 2001 From: Yasir Date: Fri, 11 Sep 2026 12:11:53 +0300 Subject: [PATCH] chore: improve CI cache reuse and build ordering --- .github/actions/rust/sccache/setup/action.yml | 3 ++- .github/workflows/build-and-test.yml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/actions/rust/sccache/setup/action.yml b/.github/actions/rust/sccache/setup/action.yml index b978e6bb..cdadc95b 100644 --- a/.github/actions/rust/sccache/setup/action.yml +++ b/.github/actions/rust/sccache/setup/action.yml @@ -19,7 +19,7 @@ runs: shell: bash run: | SCCACHE_DOWNLOAD_LINK=https://github.com/mozilla/sccache/releases/download - SCCACHE_VERSION=v0.2.15 + SCCACHE_VERSION=v0.17.0 SCCACHE_PREFIX="sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl" SCCACHE_TAR="${SCCACHE_PREFIX}.tar.gz" DOWNLOAD_LINK="${SCCACHE_DOWNLOAD_LINK}/${SCCACHE_VERSION}/${SCCACHE_TAR}" @@ -42,5 +42,6 @@ runs: shell: bash run: | echo "starting sccache on ${{ inputs.os }}" + sccache --version sccache --start-server sccache -s diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e802ba9e..cfb18a62 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -152,15 +152,10 @@ jobs: awk '{print $1}' | \ xargs -I {} cargo check -p {} - # Clean debug target to avoid bloating the GitHub Actions cache. - # The previous builds cannot be re-used at all for the full --all-features --release build anyway. - - name: Clean target + # Remove debug artifacts from feature checks while preserving cached release artifacts. + - name: Clean debug target if: matrix.os == 'ubuntu-24.04' - run: cargo clean - - # Build the library, tests, and examples without running them to avoid recompilation in the run tests step - - name: Build with default features - run: cargo build --workspace --tests --examples --release + run: cargo clean --profile dev - name: Start iota sandbox if: matrix.os != 'windows-latest' @@ -196,6 +191,11 @@ jobs: echo "IOTA_TF_COMPONENTS_PKG_ID=$IOTA_TF_COMPONENTS_PKG_ID" >> "$GITHUB_ENV" working-directory: audit-trail-move/scripts/ + # Move testing and publication can update Move.lock, which the Rust build scripts watch. + # Build afterward so tests and examples reuse artifacts from the final Move inputs. + - name: Build with default features + run: cargo build --workspace --tests --examples --release + - name: Run tests if: matrix.os != 'windows-latest' run: cargo test --workspace --release -- --test-threads=1