From 94254edd886ea8464df63e87ca72a1e4212b0fa3 Mon Sep 17 00:00:00 2001 From: Binh Duc Tran Date: Sat, 23 Mar 2024 10:22:47 +0700 Subject: [PATCH] ci: update cache strategy --- .github/workflows/ci.yml | 16 +++++----------- .github/workflows/gh-page.yml | 18 ++++++------------ 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 311d34a..be13a81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,28 +11,19 @@ jobs: PERSEUS_VERSION: 0.4.0 name: Build and Test runs-on: ubuntu-latest - strategy: - matrix: - toolchain: - - stable steps: - name: Checkout respository uses: actions/checkout@v4 - - name: Cache Cargo and Rustup + - name: Cache cargo binaries uses: actions/cache@v4 id: cache with: path: | - ~/.cargo/ - ~/.rustup/ + ~/.cargo/bin/ # The cache should be OS-specific key: ${{ runner.os }}-website-cargo-bins-$PERSEUS_VERSION - - name: Setup Rust - if: steps.cache.outputs.cache-hit != 'true' - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -42,6 +33,9 @@ jobs: uses: actions/cache@v4 with: path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ target/ dist/ key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} diff --git a/.github/workflows/gh-page.yml b/.github/workflows/gh-page.yml index 82a5973..eed9873 100644 --- a/.github/workflows/gh-page.yml +++ b/.github/workflows/gh-page.yml @@ -20,10 +20,6 @@ jobs: PERSEUS_VERSION: 0.4.0 name: Build Static Site Generation runs-on: ubuntu-latest - strategy: - matrix: - toolchain: - - stable steps: - name: Checkout repository uses: actions/checkout@v4 @@ -31,20 +27,15 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v3 - - name: Cache Cargo and Rustup + - name: Cache cargo binaries uses: actions/cache@v4 id: cache with: path: | - ~/.cargo/ - ~/.rustup/ + ~/.cargo/bin/ # The cache should be OS-specific key: ${{ runner.os }}-website-cargo-bins-$PERSEUS_VERSION - - name: Setup Rust - if: steps.cache.outputs.cache-hit != 'true' - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - # Only install the binaries if the cache doesn't have them - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' @@ -54,9 +45,12 @@ jobs: uses: actions/cache@v4 with: path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ target/ dist/ - key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + key: ${{ runner.os }}-cargo-build-${{ hashFiles('Cargo.lock') }} - name: Build using Perseus run: perseus export --release