Unverified Commit d2799e6f authored by Daz DeBoer's avatar Daz DeBoer Committed by GitHub
Browse files

Merge pull request #142 from gradle/strict-cache-match

Improves logging for caching, and adds 2 experimental cache options:

- `gradle-home-cache-strict-match`: Avoid re-using a Gradle Home cache entry written by a different job. Only cache entries written by the current Job will be used.
- `cache-write-only`: Do not restore existing cache entries, but still save cache entries in post-action.  Fixes #141.
parents a8da4e5c 27347149
Loading
Loading
Loading
Loading
+39
Changes for .github/workflows/integTest-caching-config.yml: 39 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -101,3 +101,42 @@ jobs:
      with:
        script: |
          core.setFailed('No build scan detected')

  # Test seed the cache with cache-write-only and verify with cache-read-only
  seed-build-write-only:
    env:
      GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Setup Gradle
      uses: ./
      with:
        cache-write-only: true
    - name: Build using Gradle wrapper
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test

  verify-write-only-build:
    env:
      GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
    needs: seed-build-write-only
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Setup Gradle
      uses: ./
      with:
        cache-read-only: true
    - name: Execute Gradle build with --offline
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --offline
+9 −1
Changes for action.yml: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -48,8 +48,16 @@ inputs:

  # EXPERIMENTAL & INTERNAL ACTION INPUTS
  # The following action properties allow fine-grained tweaking of the action caching behaviour.
  # These properties are not designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
  # These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
  # Use at your own risk!
  cache-write-only:
    description: When 'true', entries will not be restored from the cache but will be saved at the end of the Job. This allows a 'clean' cache entry to be written.
    required: false
    default: false
  gradle-home-cache-strict-match:
    description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
    required: false
    default: false
  workflow-job-context:
    description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL).
    required: false
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading