From f62f74e3d26d3a385b7b52cf2a5637e2151a2b98 Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:44:43 +0200 Subject: [PATCH] Store build cache on push to main, else read-only --- .github/workflows/cargo_build_cache.yml | 29 +++++++++++++++++++++++++ .github/workflows/cl_vault.yml | 2 +- .github/workflows/rust_basic.yml | 2 +- .github/workflows/rust_test_tube.yml | 2 +- 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cargo_build_cache.yml diff --git a/.github/workflows/cargo_build_cache.yml b/.github/workflows/cargo_build_cache.yml new file mode 100644 index 000000000..8509638a3 --- /dev/null +++ b/.github/workflows/cargo_build_cache.yml @@ -0,0 +1,29 @@ +name: Store cargo build cache + +on: + push: + branches: + - main + paths: + - 'smart-contracts/**.rs' + - 'smart-contracts/**.toml' + workflow_dispatch: + +jobs: + store-build-cache: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Rust check + run: cargo check + working-directory: smart-contracts + - name: Store dependencies + uses: actions/cache/save@v4 + with: + path: | + ~/.cargo + ~/go + **/target + key: ${{ runner.os }}-cargo-$GITHUB_SHA + restore-keys: ${{ runner.os }}-cargo diff --git a/.github/workflows/cl_vault.yml b/.github/workflows/cl_vault.yml index f5a5af1c6..f6ebaa6c4 100644 --- a/.github/workflows/cl_vault.yml +++ b/.github/workflows/cl_vault.yml @@ -27,7 +27,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Restore dependencies - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | ~/.cargo diff --git a/.github/workflows/rust_basic.yml b/.github/workflows/rust_basic.yml index aa86162e6..ed49e9e45 100644 --- a/.github/workflows/rust_basic.yml +++ b/.github/workflows/rust_basic.yml @@ -24,7 +24,7 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Restore dependencies if: env.GIT_DIFF - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | ~/.cargo diff --git a/.github/workflows/rust_test_tube.yml b/.github/workflows/rust_test_tube.yml index 5f652bbc5..4ee2ef265 100644 --- a/.github/workflows/rust_test_tube.yml +++ b/.github/workflows/rust_test_tube.yml @@ -16,7 +16,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Restore dependencies - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | ~/.cargo