gradle / gradle-build-action

Execute your Gradle build and trigger dependency submission
https://github.com/marketplace/actions/gradle-build-action
MIT License
676 stars 97 forks source link

Gradle cache not saved #765

Closed gchristov closed 1 year ago

gchristov commented 1 year ago

I've noticed that my github actions don't seem to be using/saving Gradle's cache anymore. Here's what I get from the actions

Run gradle/gradle-build-action@v2
  with:
    cache-disabled: false
    cache-read-only: ***
    cache-write-only: false
    gradle-home-cache-includes: caches
  notifications

    generate-job-summary: ***
    gradle-home-cache-strict-match: false
    workflow-job-context: null
    gradle-home-cache-cleanup: false
  env:
    JAVA_VERSION: 15
    FIREBASE_API_KEY: ***
    FIREBASE_AUTH_DOMAIN: ***
    FIREBASE_PROJECT_ID: ***
    FIREBASE_STORAGE_BUCKET: ***
    FIREBASE_GCM_SENDER_ID: ***
    FIREBASE_APPLICATION_ID: ***
    GCP_SA_KEY: ***
    SLACK_SIGNING_SECRET: ***
    SLACK_REQUEST_VERIFICATION_ENABLED: ***
    SLACK_CLIENT_ID: ***
    SLACK_CLIENT_SECRET: ***
    APP_LOG_LEVEL: ***
    APP_NETWORK_HTML_LOG_LEVEL: ***
    APP_NETWORK_JSON_LOG_LEVEL: ***
    JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/15.0.10-5/x6[4](https://github.com/gchristov/thecodinglove-kmp/actions/runs/5437752563/jobs/9888513516#step:4:4)
    JAVA_HOME_1[5](https://github.com/gchristov/thecodinglove-kmp/actions/runs/5437752563/jobs/9888513516#step:4:5)_X[6](https://github.com/gchristov/thecodinglove-kmp/actions/runs/5437752563/jobs/9888513516#step:4:6)4: /opt/hostedtoolcache/Java_Zulu_jdk/15.0.[10](https://github.com/gchristov/thecodinglove-kmp/actions/runs/5437752563/jobs/9888513516#step:4:10)-5/x64

Restore Gradle state from cache
  Gradle User Home cache not found. Will initialize empty.

and here's my actual config

      - name: Setup Java
        uses: actions/setup-java@v3
        with:
          distribution: 'zulu'
          java-version: ${{ env.JAVA_VERSION }}
      - name: Gradle cache
        uses: gradle/gradle-build-action@v2
      - name: Build Javascript app
        run: |
          set -o pipefail && 
          ./gradlew assemble

after which I get

Post job cleanup.
In final post-action step, saving state and writing summary
Cache is read-only: will not save state for use in subsequent builds.
Writing job summary

I haven't really made any changes to my config. Any ideas why this might not be saving the cache?

gchristov commented 1 year ago

I do have a Java setup task but it doesn't use caching

      - name: Setup Java
        uses: actions/setup-java@v3
        with:
          distribution: 'zulu'
          java-version: ${{ env.JAVA_VERSION }}
gchristov commented 1 year ago

I just noticed this which might explain the behaviour as I’m running this on a PR branch.

I’ll give it a try on my default branch and if it works I’ll close the issue 👍

bigdaz commented 1 year ago

I'm going to close this for now. Please comment if you think you've discovered a bug.