Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit a7b7438

Browse files
authored
Merge pull request #968 : Prepare for version 3.x
Contains all functionality planned for the initial 3.x release. - Fixes #726 - Fixes #946 - Fixes #966 - Fixes #996
2 parents 982da8e + e6566cd commit a7b7438

19 files changed

+26735
-14606
lines changed

.github/workflows/ci-full-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
cache-key-prefix: ${{github.run_number}}-
2626

2727
caching-config:
28-
uses: ./.github/workflows/integ-test-action-inputs-caching.yml
28+
uses: ./.github/workflows/integ-test-caching-config.yml
2929
with:
3030
cache-key-prefix: ${{github.run_number}}-
3131

.github/workflows/ci-quick-check.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545

4646
caching-config:
4747
needs: build-distribution
48-
uses: ./.github/workflows/integ-test-action-inputs-caching.yml
48+
uses: ./.github/workflows/integ-test-caching-config.yml
4949
with:
5050
runner-os: '["ubuntu-latest"]'
5151
download-dist: true
@@ -87,12 +87,12 @@ jobs:
8787
runner-os: '["ubuntu-latest"]'
8888
download-dist: true
8989

90-
# restore-configuration-cache:
91-
# needs: build-distribution
92-
# uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
93-
# with:
94-
# runner-os: '["ubuntu-latest"]'
95-
# download-dist: true
90+
restore-configuration-cache:
91+
needs: build-distribution
92+
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
93+
with:
94+
runner-os: '["ubuntu-latest"]'
95+
download-dist: true
9696

9797
restore-containerized-gradle-home:
9898
needs: build-distribution

.github/workflows/integ-test-action-inputs-caching.yml renamed to .github/workflows/integ-test-caching-config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test action inputs for caching
1+
name: Test caching configuration
22

33
on:
44
workflow_call:
@@ -38,7 +38,8 @@ jobs:
3838
enterprise
3939
# Exclude build-cache from main cache entry
4040
gradle-home-cache-excludes: |
41-
caches/build-cache-1
41+
caches/build-cache-*
42+
caches/*/executionHistory
4243
- name: Build using Gradle wrapper
4344
working-directory: .github/workflow-samples/groovy-dsl
4445
run: ./gradlew test
@@ -63,7 +64,8 @@ jobs:
6364
caches
6465
enterprise
6566
gradle-home-cache-excludes: |
66-
caches/build-cache-1
67+
caches/build-cache-*
68+
caches/*/executionHistory
6769
cache-read-only: true
6870
- name: Execute Gradle build with --offline
6971
working-directory: .github/workflow-samples/groovy-dsl

.github/workflows/integ-test-restore-configuration-cache.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ jobs:
3434
uses: ./
3535
with:
3636
cache-read-only: false # For testing, allow writing cache entries on non-default branches
37+
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
38+
gradle-version: release-nightly
3739
- name: Groovy build with configuration-cache enabled
3840
working-directory: .github/workflow-samples/groovy-dsl
39-
run: ./gradlew test --configuration-cache
41+
run: gradle test --configuration-cache
4042

4143
verify-build-groovy:
4244
env:
@@ -55,10 +57,12 @@ jobs:
5557
uses: ./
5658
with:
5759
cache-read-only: true
60+
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
61+
gradle-version: release-nightly
5862
- name: Groovy build with configuration-cache enabled
5963
id: execute
6064
working-directory: .github/workflow-samples/groovy-dsl
61-
run: ./gradlew test --configuration-cache
65+
run: gradle test --configuration-cache
6266
- name: Check that configuration-cache was used
6367
uses: actions/github-script@v7
6468
with:
@@ -88,9 +92,11 @@ jobs:
8892
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
8993
with:
9094
cache-read-only: true
95+
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
96+
gradle-version: release-nightly
9197
- name: Check execute Gradle build with configuration cache enabled (but not restored)
9298
working-directory: .github/workflow-samples/groovy-dsl
93-
run: ./gradlew test --configuration-cache
99+
run: gradle test --configuration-cache
94100

95101
seed-build-kotlin:
96102
env:
@@ -108,9 +114,11 @@ jobs:
108114
uses: ./
109115
with:
110116
cache-read-only: false # For testing, allow writing cache entries on non-default branches
117+
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
118+
gradle-version: release-nightly
111119
- name: Execute 'help' with configuration-cache enabled
112120
working-directory: .github/workflow-samples/kotlin-dsl
113-
run: ./gradlew help --configuration-cache
121+
run: gradle help --configuration-cache
114122

115123
modify-build-kotlin:
116124
env:
@@ -129,9 +137,11 @@ jobs:
129137
uses: ./
130138
with:
131139
cache-read-only: false # For testing, allow writing cache entries on non-default branches
140+
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
141+
gradle-version: release-nightly
132142
- name: Execute 'test' with configuration-cache enabled
133143
working-directory: .github/workflow-samples/kotlin-dsl
134-
run: ./gradlew test --configuration-cache
144+
run: gradle test --configuration-cache
135145

136146
# Test restore configuration-cache from the third build invocation
137147
verify-build-kotlin:
@@ -151,10 +161,12 @@ jobs:
151161
uses: ./
152162
with:
153163
cache-read-only: true
164+
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
165+
gradle-version: release-nightly
154166
- name: Execute 'test' again with configuration-cache enabled
155167
id: execute
156168
working-directory: .github/workflow-samples/kotlin-dsl
157-
run: ./gradlew test --configuration-cache
169+
run: gradle test --configuration-cache
158170
- name: Check that configuration-cache was used
159171
uses: actions/github-script@v7
160172
with:

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Configuration file for asdf version manager
2-
nodejs 16.18.1
2+
nodejs 20.10.0
33
gradle 8.5

README.md

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ jobs:
9797
- run: echo "The release-candidate version was ${{ steps.setup-gradle.outputs.gradle-version }}"
9898
```
9999

100-
101100
## Caching build state between Jobs
102101

103102
The `gradle-build-action` will use the GitHub Actions cache to save and restore reusable state that may be speed up a subsequent build invocation. This includes most content that is downloaded from the internet as part of a build, as well as expensive to create content like compiled build scripts, transformed Jar files, etc.
@@ -423,103 +422,6 @@ jobs:
423422
path: build/reports/
424423
```
425424

426-
## Use the action to invoke Gradle
427-
428-
If the `gradle-build-action` is configured with an `arguments` input, then Gradle will execute a Gradle build with the arguments provided. NOTE: We recommend using the `gradle-build-action` as a "Setup Gradle" step as described above, with Gradle being invoked via a regular `run` command.
429-
430-
If no `arguments` are provided, the action will not execute Gradle, but will still cache Gradle state and configure build-scan capture for all subsequent Gradle executions.
431-
432-
```yaml
433-
name: Run Gradle on PRs
434-
on: pull_request
435-
jobs:
436-
gradle:
437-
strategy:
438-
matrix:
439-
os: [ubuntu-latest, macos-latest, windows-latest]
440-
runs-on: ${{ matrix.os }}
441-
steps:
442-
- uses: actions/checkout@v4
443-
- uses: actions/setup-java@v3
444-
with:
445-
distribution: temurin
446-
java-version: 11
447-
448-
- name: Setup and execute Gradle 'test' task
449-
uses: gradle/gradle-build-action@v2
450-
with:
451-
arguments: test
452-
```
453-
454-
### Multiple Gradle executions in the same Job
455-
456-
It is possible to configure multiple Gradle executions to run sequentially in the same job.
457-
The initial Action step will perform the Gradle setup.
458-
459-
```yaml
460-
- uses: gradle/gradle-build-action@v2
461-
with:
462-
arguments: assemble
463-
- uses: gradle/gradle-build-action@v2
464-
with:
465-
arguments: check
466-
```
467-
468-
### Gradle command-line arguments
469-
470-
The `arguments` input can be used to pass arbitrary arguments to the `gradle` command line.
471-
Arguments can be supplied in a single line, or as a multi-line input.
472-
473-
Here are some valid examples:
474-
```yaml
475-
arguments: build
476-
arguments: check --scan
477-
arguments: some arbitrary tasks
478-
arguments: build -PgradleProperty=foo
479-
arguments: |
480-
build
481-
--scan
482-
-PgradleProperty=foo
483-
-DsystemProperty=bar
484-
```
485-
486-
If you need to pass environment variables, use the GitHub Actions workflow syntax:
487-
488-
```yaml
489-
- uses: gradle/gradle-build-action@v2
490-
env:
491-
CI: true
492-
with:
493-
arguments: build
494-
```
495-
496-
### Gradle build located in a subdirectory
497-
498-
By default, the action will execute Gradle in the root directory of your project.
499-
Use the `build-root-directory` input to target a Gradle build in a subdirectory.
500-
501-
```yaml
502-
- uses: gradle/gradle-build-action@v2
503-
with:
504-
arguments: build
505-
build-root-directory: some/subdirectory
506-
```
507-
508-
### Using a specific Gradle executable
509-
510-
The action will first look for a Gradle wrapper script in the root directory of your project.
511-
If not found, `gradle` will be executed from the PATH.
512-
Use the `gradle-executable` input to execute using a specific Gradle installation.
513-
514-
```yaml
515-
- uses: gradle/gradle-build-action@v2
516-
with:
517-
arguments: build
518-
gradle-executable: /path/to/installed/gradle
519-
```
520-
521-
This mechanism can also be used to target a Gradle wrapper script that is located in a non-default location.
522-
523425
## Support for GitHub Enterprise Server (GHES)
524426

525427
You can use the `gradle-build-action` on GitHub Enterprise Server, and benefit from the improved integration with Gradle. Depending on the version of GHES you are running, certain features may be limited:

action.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ inputs:
88
description: Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
99
required: false
1010

11-
gradle-executable:
12-
description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
13-
required: false
14-
15-
build-root-directory:
16-
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
17-
required: false
18-
1911
cache-disabled:
2012
description: When 'true', all caching is disabled. No entries will be written to or read from the cache.
2113
required: false
@@ -40,6 +32,13 @@ inputs:
4032
required: false
4133
default: false
4234

35+
cache-encryption-key:
36+
description: |
37+
A base64 encoded AES key used to encrypt the configuration-cache data. The key is exported as 'GRADLE_ENCRYPTION_KEY' for later steps.
38+
A suitable key can be generated with `openssl rand -base64 16`.
39+
Configuration-cache data will not be saved/restored without an encryption key being provided.
40+
required: false
41+
4342
gradle-home-cache-includes:
4443
description: Paths within Gradle User Home to cache.
4544
required: false
@@ -59,10 +58,6 @@ inputs:
5958
required: false
6059
default: false
6160

62-
arguments:
63-
description: Gradle command line arguments (supports multi-line input)
64-
required: false
65-
6661
generate-job-summary:
6762
description: When 'false', no Job Summary will be generated for the Job.
6863
required: false
@@ -77,6 +72,22 @@ inputs:
7772
description: Specifies the number of days to retain any artifacts generated by the action. If not set, the default retention settings for the repository will apply.
7873
required: false
7974

75+
# DEPRECATED ACTION INPUTS
76+
arguments:
77+
description: Gradle command line arguments (supports multi-line input)
78+
required: false
79+
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step. See https://github.com/gradle/gradle-build-action?tab=readme-ov-file#use-the-action-to-setup-gradle.
80+
81+
build-root-directory:
82+
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
83+
required: false
84+
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step. See https://github.com/gradle/gradle-build-action?tab=readme-ov-file#use-the-action-to-setup-gradle.
85+
86+
gradle-executable:
87+
description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
88+
required: false
89+
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step. See https://github.com/gradle/gradle-build-action?tab=readme-ov-file#use-the-action-to-setup-gradle.
90+
8091
# EXPERIMENTAL & INTERNAL ACTION INPUTS
8192
# The following action properties allow fine-grained tweaking of the action caching behaviour.
8293
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
@@ -85,6 +96,7 @@ inputs:
8596
description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
8697
required: false
8798
default: false
99+
88100
workflow-job-context:
89101
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).
90102
required: false
@@ -104,7 +116,7 @@ outputs:
104116
description: Version of Gradle that was setup by the action
105117

106118
runs:
107-
using: 'node16'
119+
using: 'node20'
108120
main: 'dist/main/index.js'
109121
post: 'dist/post/index.js'
110122

0 commit comments

Comments
 (0)