From 79dcfd285bbfba03573f5b3b4a6fe3ea82652e67 Mon Sep 17 00:00:00 2001 From: Rafey Ahmad <71697384+glokta1@users.noreply.github.com> Date: Thu, 27 Oct 2022 21:04:06 +0530 Subject: [PATCH] [CI] Optimize (and fix) caching (#106) - Remove redundant flags in `key` when using rust-cache. They are automatically added by the action. - Add 'push to main' as trigger to reuse cache across PRs. See https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows\#restrictions-for-accessing-a-cache Resolves #85 --- .github/workflows/ci.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 211b7a78a8..c29608f3f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: Build & Tests on: pull_request: + push: + branches: main env: CARGO_TERM_COLOR: always @@ -110,17 +112,10 @@ jobs: # https://github.com/actions/runner/issues/409#issuecomment-752775072 components: clippy ${{ matrix.toolchain == 'nightly' && ', miri' || '' }} - # The features string contains commas which cannot be part of the cache - # key for the Rust Cache action. Instead, we hash the features - # to get a string of legal characters. - - name: Set feature string for cache key - run: | - echo "FEATURES_HASH=$(echo ${{ matrix.features }} | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_ENV - - name: Rust Cache uses: Swatinem/rust-cache@v2.0.0 with: - key: "${{ env.ZC_TOOLCHAIN }}-${{ matrix.target }}-${{ env.FEATURES_HASH }}-${{ hashFiles('**/Cargo.lock') }}" + key: "${{ matrix.target }}" - name: Check run: cargo +${{ env.ZC_TOOLCHAIN }} check --manifest-path ${{ matrix.manifest-path }} --target ${{ matrix.target }} ${{ matrix.features }} --verbose