From 1447e0535ce612ce889bb6b6d35aa3e976aaac02 Mon Sep 17 00:00:00 2001 From: etienne-k <2804556+etienne-k@users.noreply.github.com> Date: Fri, 11 Nov 2022 12:47:15 +0100 Subject: [PATCH] Use a specialized caching mechanism --- .github/workflows/rust.yml | 63 +++++++++++++------------------------- 1 file changed, 22 insertions(+), 41 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 49718a9..c8f54bb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,55 +14,40 @@ jobs: check: runs-on: ubuntu-latest steps: - - name: Cache - uses: actions/cache@v3.0.11 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ~/cargo-target/ - key: "rust-check" - uses: actions/checkout@v3 + - name: Cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: "rust" + key: "check" - name: Check run: cargo check + build: runs-on: ubuntu-latest needs: check steps: - - name: Cache - uses: actions/cache@v3.0.11 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ~/cargo-target/ - key: "rust-build" - uses: actions/checkout@v3 + - name: Cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: "rust" + key: "build" - name: Build run: cargo build + unit-tests: runs-on: ubuntu-latest needs: build steps: + - uses: actions/checkout@v3 - name: Cache - uses: actions/cache@v3.0.11 + uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ~/cargo-target/ - key: "rust-build" + shared-key: "rust" + key: "build" - name: Install nextest uses: taiki-e/install-action@nextest - - uses: actions/checkout@v3 -# - name: Run unit tests -# run: cargo nextest run - name: Run unit tests uses: actions-rs/cargo@v1 with: @@ -75,20 +60,16 @@ jobs: name: test-results path: target/nextest/ci/junit.xml reporter: java-junit + doc-tests: runs-on: ubuntu-latest needs: build steps: - - name: Cache - uses: actions/cache@v3.0.11 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ~/cargo-target/ - key: "rust-build" - uses: actions/checkout@v3 + - name: Cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: "rust" + key: "build" - name: Run documentation tests run: cargo test --doc