Skip to content

Commit

Permalink
Explicitly set cache-read-only for test invocations
Browse files Browse the repository at this point in the history
The `gradle-build-action` test workflows need to write cache entries,
even when run on non-default branches. This change add explicit configuration
to set `cache-read-only: false` when cache writing is required.
  • Loading branch information
bigdaz committed Jan 28, 2022
1 parent e1f5f66 commit de28d49
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/integTest-caching-config.yml
Expand Up @@ -22,6 +22,9 @@ jobs:
- name: Setup Gradle
uses: ./
with:
# Need to be able to write cache entries from non-default branches
cache-read-only: false

# Add "enterprise" to main cache entry but omit "notifications"
gradle-home-cache-includes: |
caches
Expand Down Expand Up @@ -116,6 +119,7 @@ jobs:
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
cache-write-only: true
- name: Build using Gradle wrapper
working-directory: __tests__/samples/groovy-dsl
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/integTest-caching-configuration-cache.yml
Expand Up @@ -24,6 +24,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Groovy build with configuration-cache enabled
working-directory: __tests__/samples/groovy-dsl
run: ./gradlew test --configuration-cache
Expand Down Expand Up @@ -83,6 +85,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Execute 'help' with configuration-cache enabled
working-directory: __tests__/samples/kotlin-dsl
run: ./gradlew help --configuration-cache
Expand All @@ -100,6 +104,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Execute 'test' with configuration-cache enabled
working-directory: __tests__/samples/kotlin-dsl
run: ./gradlew test --configuration-cache
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integTest-caching-gradle-home.yml
Expand Up @@ -20,6 +20,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Build using Gradle wrapper
working-directory: __tests__/samples/groovy-dsl
run: ./gradlew test
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integTest-caching-java-toolchain.yml
Expand Up @@ -20,6 +20,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Build using Gradle wrapper
working-directory: __tests__/samples/java-toolchain
run: ./gradlew test --info
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/integTest-execution-with-caching.yml
Expand Up @@ -20,7 +20,8 @@ jobs:
uses: actions/checkout@v2
- name: Exucute Gradle build
uses: ./
with:
with:
cache-read-only: false
build-root-directory: __tests__/samples/groovy-dsl
arguments: test

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integTest-gradle-user-home.yml
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Build using Gradle wrapper
working-directory: __tests__/samples/groovy-dsl
run: ./gradlew test --info
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/integTest-sample-gradle-plugin.yml
Expand Up @@ -21,6 +21,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Build gradle-plugin project
working-directory: __tests__/samples/gradle-plugin
run: ./gradlew build
Expand All @@ -36,6 +38,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: true
- name: Build gradle-plugin project
working-directory: __tests__/samples/gradle-plugin
run: ./gradlew build --offline
4 changes: 4 additions & 0 deletions .github/workflows/integTest-sample-kotlin-dsl.yml
Expand Up @@ -21,6 +21,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: false
- name: Build kotlin-dsl project
working-directory: __tests__/samples/kotlin-dsl
run: ./gradlew build
Expand All @@ -36,6 +38,8 @@ jobs:
uses: actions/checkout@v2
- name: Setup Gradle
uses: ./
with:
cache-read-only: true
- name: Build kotlin-dsl project
working-directory: __tests__/samples/kotlin-dsl
run: ./gradlew build --offline

0 comments on commit de28d49

Please sign in to comment.