From 52433f7412e6dbbb79af591027aaf97cb95c5786 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 4 Mar 2021 17:47:39 +1100 Subject: [PATCH] Use Rust cache action --- .github/workflows/ci.yml | 34 ++++++------------------------- .github/workflows/release-cli.yml | 2 ++ 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bc0037a..ff4e82e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,15 +15,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Cache ~/.cargo/bin directory - id: cargo-bin-cache - uses: actions/cache@v2.1.4 - with: - path: ~/.cargo/bin - key: ubuntu-rust-${{ hashFiles('rust-toolchain') }}-cargo-bin-directory-v1 + - uses: Swatinem/rust-cache@v1.2.0 + id: cache - name: Install tomlfmt - if: steps.cargo-bin-cache.outputs.cache-hit != 'true' + if: steps.cache.outputs.cache-hit != 'true' run: cargo install cargo-tomlfmt - name: Check Cargo.toml formatting @@ -58,13 +54,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Cache target and registry directory - uses: actions/cache@v2.1.4 - with: - path: | - target - ~/.cargo/registry - key: rust-${{ matrix.target }}-build-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1 + - uses: Swatinem/rust-cache@v1.2.0 - name: Build binary run: | @@ -99,13 +89,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Cache target and registry directory - uses: actions/cache@v2.1.4 - with: - path: | - target - ~/.cargo/registry - key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1 + - uses: Swatinem/rust-cache@v1.2.0 - name: Build tests run: cargo build --tests --workspace --all-features @@ -135,13 +119,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 - - name: Cache target and registry directory - uses: actions/cache@v2.1.4 - with: - path: | - target - ~/.cargo/registry - key: rust-${{ matrix.target }}-test-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1 + - uses: Swatinem/rust-cache@v1.2.0 - name: Run test ${{ matrix.test_name }} run: cargo test --package swap --all-features --test ${{ matrix.test_name }} "" diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 24b6635b..69c7e578 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -27,6 +27,8 @@ jobs: ref: ${{ github.event.release.target_commitish }} token: ${{ secrets.BOTTY_GITHUB_TOKEN }} + - uses: Swatinem/rust-cache@v1.2.0 + - name: Build ${{ matrix.target }} release binary run: cargo build --target=${{ matrix.target }} --release --package swap --bin swap_cli