From 01962656d7d2c8533c2125fd0db7a9db90428073 Mon Sep 17 00:00:00 2001 From: undercover-cactus Date: Mon, 14 Jul 2025 14:48:20 +0200 Subject: [PATCH] ci: caching between run in the CI to make building faster (#114) ~~Improve CI runs by adding a caching action. Between each run crates should be cached to speed up building datahaven binary.~~ ## Summary In the end the real issue was not that we were missing a caching action but that we were caching too much. We went way over the 10GB limit imposed by github (we were using 60GB of cache). So the most recent cache were deleted right away or not cache at all. The over use of the cache was happening because we were caching twice sccache folder. Once with the `mozilla-actions/sccache-action` and an other time with `Swatinem/rust-cache`. The solution was to keep caching sccache on github with `mozilla-actions/sccache-action`. In this PR we also exchange the `Swatinem/rust-cache` action to use the more standard `actions/cache@v4`. It would avoid in the future unwanted breaking changes and security issues. --------- Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> --- .../workflows/actions/setup-env/action.yml | 22 +++++++------------ .github/workflows/task-build-operator.yml | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/actions/setup-env/action.yml b/.github/workflows/actions/setup-env/action.yml index fc016e22..274a4b6f 100644 --- a/.github/workflows/actions/setup-env/action.yml +++ b/.github/workflows/actions/setup-env/action.yml @@ -25,21 +25,15 @@ runs: - name: Show sccache stats shell: bash run: sccache --show-stats - - - name: Cache cargo + target + sccache - uses: Swatinem/rust-cache@v2 + + - uses: actions/cache@v4 with: - cache-targets: true - cache-all-crates: true - shared-key: ${{ runner.os }}-${{inputs.cache-key}}-${{ hashFiles('operator/rust-toolchain.toml') }}-${{ hashFiles('operator/Cargo.lock') }} - workspaces: | - operator -> target - cache-on-failure: true - cache-bin: true - cache-directories: | - **/sccache - **/.cargo/registry - **/.cargo/git + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/task-build-operator.yml b/.github/workflows/task-build-operator.yml index 3c0ae9cc..38ee42d5 100644 --- a/.github/workflows/task-build-operator.yml +++ b/.github/workflows/task-build-operator.yml @@ -1,6 +1,6 @@ # Build Operator: CI for building the operator binary -name: DataHave Operator Rust Tests +name: DataHaven Operator Binary Build on: workflow_dispatch: