From c50f13b4580a7fc828456b4428b33e47a917b45e Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 22 Dec 2023 22:17:46 +0200 Subject: [PATCH] Improve CI caching and fix action version --- .github/workflows/rust.yml | 24 ++++++++++++++++-------- .github/workflows/rustdoc.yml | 10 ++++++++++ .github/workflows/snapshot-build.yml | 10 ++++++++++ 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 64f5081cc3..d08886f1eb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -50,6 +50,8 @@ jobs: ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- - name: cargo fmt uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 @@ -99,12 +101,14 @@ jobs: continue-on-error: true - name: Configure cache - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.3.2 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 with: path: | ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- - name: cargo clippy uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7 @@ -124,12 +128,14 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Configure cache - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.3.2 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 with: path: | ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- - name: Check Documentation run: cargo doc --locked --all --no-deps --lib @@ -177,18 +183,20 @@ jobs: # Doesn't exist on self-hosted runners continue-on-error: true - - name: Install cargo-nextest - uses: taiki-e/cache-cargo-install-action@1b76958d032c4d048c599f9fdfa48abe804d6319 # v1.2.2 - with: - tool: cargo-nextest - - name: Configure cache - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.3.2 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 with: path: | ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install cargo-nextest + uses: taiki-e/cache-cargo-install-action@1b76958d032c4d048c599f9fdfa48abe804d6319 # v1.2.2 + with: + tool: cargo-nextest - name: cargo nextest run --locked uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index 04023d8685..48d7a8cfcb 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -34,6 +34,16 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Configure cache + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + # Build the rust crate docs - name: Build Documentation run: cargo doc --all --no-deps --lib diff --git a/.github/workflows/snapshot-build.yml b/.github/workflows/snapshot-build.yml index 3a3bfff9a2..064798612a 100644 --- a/.github/workflows/snapshot-build.yml +++ b/.github/workflows/snapshot-build.yml @@ -159,6 +159,16 @@ jobs: run: sudo apt-get update && sudo apt-get install -y --no-install-recommends g++-aarch64-linux-gnu gcc-aarch64-linux-gnu libc6-dev-arm64-cross if: matrix.build.target == 'aarch64-unknown-linux-gnu' + - name: Configure cache + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Build farmer uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 with: