From 94a263d9889003314c11e6dea86f254cff85be61 Mon Sep 17 00:00:00 2001 From: Jakub Kaspar Date: Fri, 20 Mar 2020 14:22:45 +0100 Subject: [PATCH] Update cache strategy with keys --- .github/workflows/ci_pr_example.yml | 16 ++++++++++------ .github/workflows/ci_pr_framework.yml | 6 ++++-- .github/workflows/ci_pr_tests.yml | 6 ++++-- .github/workflows/danger.yml | 6 ++++-- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci_pr_example.yml b/.github/workflows/ci_pr_example.yml index dbeb0922..cf543790 100644 --- a/.github/workflows/ci_pr_example.yml +++ b/.github/workflows/ci_pr_example.yml @@ -13,15 +13,19 @@ jobs: uses: actions/cache@v1 with: path: Example/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Example/Podfile.lock') }} + key: ${{ runner.os }}-example-${{ env.cache-name }}-pods-${{ hashFiles('**/Example/Podfile.lock') }} restore-keys: | - ${{ runner.os }}-pods- - - name: Cache SPM + ${{ runner.os }}-example-${{ env.cache-name }}-pods- + ${{ runner.os }}-example-${{ env.cache-name }}- + ${{ runner.os }}-example- + - name: Cache Gems uses: actions/cache@v1 with: - path: .build - key: ${{ runner.os }}-gems-${{ hashFiles('**/Example/Gemfile.lock') }} + path: vendor/bundle + key: ${{ runner.os }}-example-${{ env.cache-name }}-gems-${{ hashFiles('**/Example/Gemfile.lock') }} restore-keys: | - ${{ runner.os }}-gems- + ${{ runner.os }}-example-${{ env.cache-name }}-gems- + ${{ runner.os }}-example-${{ env.cache-name }}- + ${{ runner.os }}-example- - name: Build and run example project run: ./GitHubActions/build.sh example diff --git a/.github/workflows/ci_pr_framework.yml b/.github/workflows/ci_pr_framework.yml index 3093777a..2d17fbbc 100644 --- a/.github/workflows/ci_pr_framework.yml +++ b/.github/workflows/ci_pr_framework.yml @@ -13,8 +13,10 @@ jobs: uses: actions/cache@v1 with: path: Carthage - key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} + key: ${{ runner.os }}-framework-${{ env.cache-name }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} restore-keys: | - ${{ runner.os }}-carthage- + ${{ runner.os }}-framework-${{ env.cache-name }}-carthage- + ${{ runner.os }}-framework-${{ env.cache-name }}- + ${{ runner.os }}-framework- - name: Build framework run: ./GitHubActions/build.sh framework diff --git a/.github/workflows/ci_pr_tests.yml b/.github/workflows/ci_pr_tests.yml index cf1a250f..65cc396d 100644 --- a/.github/workflows/ci_pr_tests.yml +++ b/.github/workflows/ci_pr_tests.yml @@ -13,8 +13,10 @@ jobs: uses: actions/cache@v1 with: path: Carthage - key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} + key: ${{ runner.os }}-tests-${{ env.cache-name }}-carthage-${{ hashFiles('**/Cartfile.resolved') }} restore-keys: | - ${{ runner.os }}-carthage- + ${{ runner.os }}-tests-${{ env.cache-name }}-carthage- + ${{ runner.os }}-tests-${{ env.cache-name }}- + ${{ runner.os }}-tests- - name: Build and run tests run: ./GitHubActions/build.sh tests diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 5dbb31fc..5e149e68 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -13,9 +13,11 @@ jobs: uses: actions/cache@v1 with: path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} + key: ${{ runner.os }}-danger-${{ env.cache-name }}-gems-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | - ${{ runner.os }}-gems- + ${{ runner.os }}-danger-${{ env.cache-name }}-gems- + ${{ runner.os }}-danger-${{ env.cache-name }}- + ${{ runner.os }}-danger- - name: Run build script run: gem install bundler && bundle install && bundle exec danger --fail-on-errors=true env: