From e602d3dd7e343dac29c172825f3f2f730806e534 Mon Sep 17 00:00:00 2001 From: Carter Jernigan Date: Wed, 15 Jun 2022 15:25:41 -0400 Subject: [PATCH] [#545] GitHub Cache Action 3.0.4 Also updated the caching to be a bit simpler and more efficient. --- .github/actions/setup/action.yml | 36 ++++++++++++-------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index ad5ea8af..c67217b1 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -31,45 +31,35 @@ runs: echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties - name: Gradle Wrapper Cache id: gradle-wrapper-cache - uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09 + uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles(format('{0}{1}', github.workspace, '/gradle/wrapper/gradle-wrapper.properties')) }} - name: Gradle Dependency Cache id: gradle-dependency-cache - uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09 + uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d with: path: ~/.gradle/caches/modules-2 key: ${{ runner.os }}-gradle-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/gradle.properties')) }} restore-keys: | - ${{ runner.os }}-gradle-deps - # This tries to fall back to the build cache from the main branch, while ensuring that - # main branch builds repopulate the cache each time. - - name: Gradle Build Cache Main - id: gradle-build-cache-main - if: github.event.pull_request.head.sha == '' - uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09 + ${{ runner.os }}-gradle-deps- +# The build cache is doing two things: +# 1. Relying on the most recent main branch build to provide a partial cache for both main branch and PR builds. +# 2. Relying on the sha for an exact match so that the prime_cache job is re-used by all dependent jobs in a single workflow run + - name: Gradle Build Cache + id: gradle-build-cache + uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d with: path: | ~/.gradle/caches/build-cache-1 ~/.gradle/caches/transforms-3 + .gradle/configuration-cache key: ${{ runner.os }}-gradle-build-${{ github.sha }} restore-keys: | - ${{ runner.os }}-gradle-build - - name: Gradle Build Cache Pull Request - id: gradle-build-cache-pr - if: github.event.pull_request.head.sha != '' - uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09 - with: - path: | - ~/.gradle/caches/build-cache-1 - ~/.gradle/caches/transforms-3 - key: ${{ runner.os }}-gradle-build-${{ github.event.pull_request.base.sha }} - restore-keys: | - ${{ runner.os }}-gradle-build + ${{ runner.os }}-gradle-build- - name: Rust Cache id: rust-cache - uses: actions/cache@48af2dc4a9e8278b89d7fa154b955c30c6aaab09 + uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d with: path: | sdk-lib/target @@ -86,7 +76,7 @@ runs: run: | ./gradlew dependencies :sdk-lib:dependencies :demo-app:dependencies - name: Compile - if: steps.gradle-build-cache-main.outputs.cache-hit != 'true' && steps.gradle-build-cache-pr.outputs.cache-hit != 'true' + if: steps.gradle-build-cache.outputs.cache-hit != 'true' shell: bash env: ORG_GRADLE_PROJECT_IS_MINIFY_APP_ENABLED: "false"