From 0473c4b5f060b560cf3c548a12fbf4ca670d588b Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Thu, 14 Mar 2024 09:40:34 +0100 Subject: [PATCH] Clear and generate new cache only when merging to `develop` (#2549) Clearing the cache regularly doesn't work because on each new merge to develop a new cache of almost 4GB will be created and replace the 'cleared' one. We can try doing a clean up to this cache we're about to save so it's a bit smaller. --- .github/workflows/clear-cache.yml | 34 ------------------------------- .github/workflows/tests.yml | 1 + 2 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 .github/workflows/clear-cache.yml diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml deleted file mode 100644 index ae24a0789a..0000000000 --- a/.github/workflows/clear-cache.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Clear Gradle Cache - -on: - workflow_dispatch: - schedule: - # Every nights at 4 - - cron: "0 4 * * *" - -# Enrich gradle.properties for CI/CD -env: - GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx8g -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.incremental=false -XX:+UseParallelGC - CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 8 --warn - -jobs: - tests: - name: Clear Gradle cache - runs-on: ubuntu-latest - - steps: - - name: ⏬ Checkout with LFS - uses: nschloe/action-cached-lfs-checkout@v1.2.2 - - name: ☕️ Use JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' # See 'Supported distributions' for available options - java-version: '17' - - name: Configure gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # This should build the project and run the tests, and the build files will be used to diff with the cache - - name: ⚙️ Build the GPlay debug variant, run unit tests - run: ./gradlew :app:assembleGplayDebug test $CI_GRADLE_ARG_PROPERTIES diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 89ca5047e7..7ae77e3c13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,6 +47,7 @@ jobs: uses: gradle/actions/setup-gradle@v3 with: cache-read-only: ${{ github.ref != 'refs/heads/develop' }} + gradle-home-cache-cleanup: ${{ github.ref == 'refs/heads/develop' }} - name: ⚙️ Run unit tests, debug and release run: ./gradlew test $CI_GRADLE_ARG_PROPERTIES