[#545] GitHub Cache Action 3.0.4

Also updated the caching to be a bit simpler and more efficient.
This commit is contained in:
Carter Jernigan 2022-06-15 15:25:41 -04:00 committed by Carter Jernigan
parent 22d9cbecc0
commit e602d3dd7e
1 changed files with 13 additions and 23 deletions

View File

@ -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"