From 9bc4b79fe1fae2b11e508a4ed7f6b7b8b462f92c Mon Sep 17 00:00:00 2001 From: LoveSy Date: Mon, 31 May 2021 20:48:41 +0800 Subject: [PATCH] [CI] separate gradle cache (#712) --- .github/workflows/core.yml | 19 ++++++++++++++----- .github/workflows/manager.yml | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 6349b4ff..3464b7b1 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -34,15 +34,24 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 - - name: Cache Gradle + - name: Cache Gradle Dependencies uses: actions/cache@v2 with: path: | ~/.gradle/caches ~/.gradle/wrapper - key: gradle-core-${{ github.sha }} + !~/.gradle/caches/build-cache-* + key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }} restore-keys: | - gradle- + gradle-deps + - name: Cache Gradle Build + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches/build-cache-* + key: gradle-builds-core-${{ github.sha }} + restore-keys: | + gradle-builds - name: Cache Cmake uses: actions/cache@v2 with: @@ -56,8 +65,8 @@ jobs: ccache -o hash_dir=false - name: Build with Gradle run: | - [ $(du -s ~/.gradle/wrapper | awk '{ print $1 }') -gt 250000 ] && rm -rf ~/.gradle/wrapper/* - find ~/.gradle/caches -exec touch -d "2 days ago" {} + + [ $(du -s ~/.gradle/wrapper | awk '{ print $1 }') -gt 250000 ] && rm -rf ~/.gradle/wrapper/* || true + find ~/.gradle/caches -exec touch -d "2 days ago" {} + || true echo 'org.gradle.caching=true' >> gradle.properties echo 'org.gradle.parallel=true' >> gradle.properties echo 'org.gradle.vfs.watch=true' >> gradle.properties diff --git a/.github/workflows/manager.yml b/.github/workflows/manager.yml index be4ab8a2..72326793 100644 --- a/.github/workflows/manager.yml +++ b/.github/workflows/manager.yml @@ -35,15 +35,24 @@ jobs: echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties echo androidStoreFile='key.jks' >> gradle.properties echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks - - name: Cache Gradle + - name: Cache Gradle Dependencies uses: actions/cache@v2 with: path: | ~/.gradle/caches ~/.gradle/wrapper - key: gradle-manager-${{ github.sha }} + !~/.gradle/caches/build-cache-* + key: gradle-deps-manager-${{ hashFiles('**/build.gradle.kts') }} restore-keys: | - gradle- + gradle-deps + - name: Cache Gradle Build + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches/build-cache-* + key: gradle-builds-manager-${{ github.sha }} + restore-keys: | + gradle-builds - name: Build with Gradle id: buildRelease run: |