Skip to content

Commit 8eb4434

Browse files
authored
Add setup gradle action (#56)
1 parent 4096d78 commit 8eb4434

File tree

9 files changed

+535
-5
lines changed

9 files changed

+535
-5
lines changed

.github/PklProject.deps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1": {
1212
"type": "local",
13-
"uri": "projectpackage://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1.1.6",
13+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1.2.0",
1414
"path": "../packages/pkl.impl.ghactions"
1515
},
1616
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": {

packages/pkl.impl.ghactions/PklCI.pkl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//===----------------------------------------------------------------------===//
2-
// Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
2+
// Copyright © 2025-2026 Apple Inc. and the Pkl project authors. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -18,11 +18,11 @@ module pkl.impl.ghactions.PklCI
1818
extends "DependabotManagedCI.pkl"
1919

2020
import "@com.github.actions/actions/checkout/v6/Checkout.pkl"
21-
import "@com.github.actions/catalog.pkl"
2221
import "@com.github.actions/context.pkl"
2322
import "@com.github.actions/Workflow.pkl"
2423

2524
import "actions/PublishUnitTestResult.pkl"
25+
import "catalog.pkl" as Catalog
2626
import "helpers.pkl"
2727
import "jobs/CheckPklEval.pkl"
2828
import "util.pkl"
@@ -37,6 +37,9 @@ local checkPklGHADefinitions: CheckPklEval = new {
3737
}
3838
}
3939

40+
/// The catalog of actions
41+
catalog: Catalog
42+
4043
/// The workflow that runs during pull requests.
4144
///
4245
/// The following fields are overwritten and therefore don't need to be set:

packages/pkl.impl.ghactions/PklProject

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//===----------------------------------------------------------------------===//
2-
// Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
2+
// Copyright © 2025-2026 Apple Inc. and the Pkl project authors. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
1717
amends "../basePklProject.pkl"
1818

1919
package {
20-
version = "1.1.6"
20+
version = "1.2.0"
2121
}
2222

2323
dependencies {
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
//===----------------------------------------------------------------------===//
2+
// Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//===----------------------------------------------------------------------===//
16+
/// Configures Gradle for GitHub actions, caching state and generating a dependency graph via Dependency Submission.
17+
module pkl.impl.ghactions.actions.gradle.actions.`setup-gradle`.v5.SetupGradle
18+
19+
extends "@com.github.actions/AbstractTypedStep.pkl"
20+
21+
fixed action: "gradle/actions/setup-gradle"
22+
23+
fixed version: "v5"
24+
25+
with: With
26+
27+
class With {
28+
/// Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
29+
/// If not provided, it is assumed that the project uses the Gradle Wrapper.
30+
`gradle-version`: String?
31+
32+
/// When 'true', all caching is disabled. No entries will be written to or read from the cache.
33+
///
34+
/// Default if unspecified: `false`
35+
`cache-disabled`: Boolean?
36+
37+
/// When 'true', existing entries will be read from the cache but no entries will be written.
38+
/// By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
39+
///
40+
/// Default if unspecified: `"${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}"`
41+
`cache-read-only`: Boolean?
42+
43+
/// When 'true', entries will not be restored from the cache but will be saved at the end of the Job.
44+
/// Setting this to 'true' implies cache-read-only will be 'false'.
45+
///
46+
/// Default if unspecified: `false`
47+
`cache-write-only`: Boolean?
48+
49+
/// When 'true', a pre-existing Gradle User Home will not prevent the cache from being restored.
50+
///
51+
/// Default if unspecified: `false`
52+
`cache-overwrite-existing`: Boolean?
53+
54+
/// A base64 encoded AES key used to encrypt the configuration-cache data. The key is exported as 'GRADLE_ENCRYPTION_KEY' for later steps.
55+
/// A suitable key can be generated with `openssl rand -base64 16`.
56+
/// Configuration-cache data will not be saved/restored without an encryption key being provided.
57+
`cache-encryption-key`: String?
58+
59+
/// Specifies if the action should attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache.
60+
/// By default ('on-success'), cleanup is performed when all Gradle builds succeed for the Job.
61+
/// This behaviour can be disabled ('never'), or configured to always run irrespective of the build outcome ('always').
62+
/// Valid values are 'never', 'on-success' and 'always'.
63+
///
64+
/// Default if unspecified: `"on-success"`
65+
`cache-cleanup`: ("never" | "on-success" | "always")?
66+
67+
/// When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache.
68+
`gradle-home-cache-cleanup`: Boolean?
69+
70+
/// Paths within Gradle User Home to cache.
71+
///
72+
/// Default if unspecified: `"""
73+
/// caches
74+
/// notifications
75+
///
76+
/// """`
77+
hidden `gradle-home-cache-includes-list`: Listing<String>?
78+
79+
/// Paths within Gradle User Home to cache.
80+
///
81+
/// Default if unspecified: `"""
82+
/// caches
83+
/// notifications
84+
///
85+
/// """`
86+
///
87+
/// To set as a [Listing], use [`gradle-home-cache-includes-list`].
88+
`gradle-home-cache-includes`: String? = `gradle-home-cache-includes-list`?.join("\n")
89+
90+
/// Paths within Gradle User Home to exclude from cache.
91+
hidden `gradle-home-cache-excludes-list`: Listing<String>?
92+
93+
/// Paths within Gradle User Home to exclude from cache.
94+
///
95+
/// To set as a [Listing], use [`gradle-home-cache-excludes-list`].
96+
`gradle-home-cache-excludes`: String? = `gradle-home-cache-excludes-list`?.join("\n")
97+
98+
/// Specifies when a Job Summary should be inluded in the action results. Valid values are 'never', 'always' (default), and 'on-failure'.
99+
///
100+
/// Default if unspecified: `"always"`
101+
`add-job-summary`: ("never" | "always" | "on-failure")?
102+
103+
/// Specifies when each Job Summary should be added as a PR comment. Valid values are 'never' (default), 'always', and 'on-failure'. No action will be taken if the workflow was not triggered from a pull request.
104+
///
105+
/// Default if unspecified: `"never"`
106+
`add-job-summary-as-pr-comment`: ("never" | "always" | "on-failure")?
107+
108+
/// Specifies if a GitHub dependency snapshot should be generated for each Gradle build, and if so, how.
109+
/// Valid values are 'disabled' (default), 'generate', 'generate-and-submit', 'generate-submit-and-upload', 'generate-and-upload', and 'download-and-submit'.
110+
///
111+
/// Default if unspecified: `"disabled"`
112+
`dependency-graph`: (
113+
"disabled"
114+
| "generate"
115+
| "generate-and-submit"
116+
| "generate-submit-and-upload"
117+
| "generate-and-upload"
118+
| "download-and-submit"
119+
)?
120+
121+
/// Specifies where the dependency graph report will be generated.
122+
/// Paths can relative or absolute. Relative paths are resolved relative to the workspace directory.
123+
///
124+
/// Default if unspecified: `"dependency-graph-reports"`
125+
`dependency-graph-report-dir`: String?
126+
127+
/// When 'false' a failure to generate or submit a dependency graph will fail the Step or Job. When 'true' a warning will be emitted but no failure will result.
128+
///
129+
/// Default if unspecified: `true`
130+
`dependency-graph-continue-on-failure`: Boolean?
131+
132+
/// Gradle projects that should be excluded from dependency graph (regular expression).
133+
/// When set, any matching project will be excluded.
134+
`dependency-graph-exclude-projects`: String?
135+
136+
/// Gradle projects that should be included in dependency graph (regular expression).
137+
/// When set, only matching projects will be included.
138+
`dependency-graph-include-projects`: String?
139+
140+
/// Gradle configurations that should be included in dependency graph (regular expression).
141+
/// When set, anymatching configurations will be excluded.
142+
`dependency-graph-exclude-configurations`: String?
143+
144+
/// Gradle configurations that should be included in dependency graph (regular expression).
145+
/// When set, only matching configurations will be included.
146+
`dependency-graph-include-configurations`: String?
147+
148+
/// 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.
149+
`artifact-retention-days`: Int?
150+
151+
/// Set to 'true' to automatically publish build results as a Build Scan on scans.gradle.com.
152+
/// For publication to succeed without user input, you must also provide values for `build-scan-terms-of-use-url` and 'build-scan-terms-of-use-agree'.
153+
///
154+
/// Default if unspecified: `false`
155+
`build-scan-publish`: Boolean?
156+
157+
/// The URL to the Build Scan® terms of use. This input must be set to 'https://gradle.com/terms-of-service' or 'https://gradle.com/help/legal-terms-of-use'.
158+
`build-scan-terms-of-use-url`: String?
159+
160+
/// Indicate that you agree to the Build Scan® terms of use. This input value must be "yes".
161+
`build-scan-terms-of-use-agree`: ("yes")?
162+
163+
/// Develocity access key. Should be set to a secret containing the Develocity Access key.
164+
`develocity-access-key`: String?
165+
166+
/// The Develocity short-lived access tokens expiry in hours. Default is 2 hours.
167+
`develocity-token-expiry`: Int?
168+
169+
/// Enables Develocity injection.
170+
`develocity-injection-enabled`: Boolean?
171+
172+
/// The URL for the Develocity server.
173+
`develocity-url`: String?
174+
175+
/// Allow communication with an untrusted server; set to _true_ if your Develocity instance is using a self-signed.
176+
`develocity-allow-untrusted-server`: Boolean?
177+
178+
/// Enables capturing the paths and content hashes of each individual input file.
179+
`develocity-capture-file-fingerprints`: Boolean?
180+
181+
/// Enforce the configured Develocity URL over a URL configured in the project's build; set to _true_ to enforce publication of build scans to the configured Develocity URL.
182+
`develocity-enforce-url`: Boolean?
183+
184+
/// The version of the Develocity Gradle plugin to apply.
185+
`develocity-plugin-version`: String?
186+
187+
/// The version of the Common Custom User Data Gradle plugin to apply, if any.
188+
`develocity-ccud-plugin-version`: String?
189+
190+
/// The URL of the repository to use when resolving the Develocity and CCUD plugins; the Gradle Plugin Portal is used by default.
191+
`gradle-plugin-repository-url`: String?
192+
193+
/// The username for the repository URL to use when resolving the Develocity and CCUD.
194+
`gradle-plugin-repository-username`: String?
195+
196+
/// The password for the repository URL to use when resolving the Develocity and CCUD plugins; Consider using secrets to pass the value to this variable.
197+
`gradle-plugin-repository-password`: String?
198+
199+
/// When 'true' (the default) the action will automatically validate all wrapper jars found in the repository.
200+
/// If the wrapper checksums are not valid, the action will fail.
201+
///
202+
/// Default if unspecified: `true`
203+
`validate-wrappers`: Boolean?
204+
205+
/// When 'true', wrapper validation will include the checksums of snapshot wrapper jars.
206+
/// Use this if you are running with nightly or snapshot versions of the Gradle wrapper.
207+
///
208+
/// Default if unspecified: `false`
209+
`allow-snapshot-wrappers`: Boolean?
210+
211+
/// Gradle command line arguments (supports multi-line input)
212+
arguments: String?
213+
214+
/// When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
215+
///
216+
/// Default if unspecified: `false`
217+
`gradle-home-cache-strict-match`: Boolean?
218+
219+
/// Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL).
220+
///
221+
/// Default if unspecified: `"${{ toJSON(matrix) }}"`
222+
`workflow-job-context`: String?
223+
224+
/// The GitHub token used to authenticate when submitting via the Dependency Submission API.
225+
///
226+
/// Default if unspecified: `"${{ github.token }}"`
227+
`github-token`: String?
228+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//===----------------------------------------------------------------------===//
2+
// Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//===----------------------------------------------------------------------===//
16+
extends "@com.github.actions/catalog.pkl"
17+
18+
import "actions/gradle/actions/setup-gradle/v5/SetupGradle.pkl"
19+
import "actions/PublishUnitTestResult.pkl"
20+
21+
/// Configures Gradle for GitHub actions, caching state and generating a dependency graph via
22+
/// Dependency Submission.
23+
`gradle/actions/setup-gradle@v5`: SetupGradle
24+
25+
/// GitHub Action to publish unit test results on GitHub for Linux
26+
`EnricoMi/publish-unit-test-result-action@v2`: PublishUnitTestResult
27+
28+
/// GitHub Action to publish unit test results on GitHub for Windows
29+
`EnricoMi/publish-unit-test-result-action/windows@v2`: PublishUnitTestResult = new {
30+
os = "windows"
31+
}
32+
33+
/// GitHub Action to publish unit test results on GitHub for Windows without Powershell
34+
`EnricoMi/publish-unit-test-result-action/windows/bash@v2`: PublishUnitTestResult = new {
35+
os = "windows"
36+
noPowershell = true
37+
}
38+
39+
/// GitHub Action to publish unit test results on GitHub for macOS
40+
`EnricoMi/publish-unit-test-result-action/macos@v2`: PublishUnitTestResult = new {
41+
os = "macOS"
42+
}

scripts/PklProject

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===----------------------------------------------------------------------===//
2+
// Copyright © 2026 Apple Inc. and the Pkl project authors. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//===----------------------------------------------------------------------===//
16+
amends "pkl:Project"
17+
18+
dependencies {
19+
["com.github.actions.contrib"] {
20+
uri = "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions.contrib@1.0.3"
21+
}
22+
["io.typesafegithub.github"] {
23+
uri = "package://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1.0.0"
24+
}
25+
}

scripts/PklProject.deps.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"schemaVersion": 1,
3+
"resolvedDependencies": {
4+
"package://pkg.pkl-lang.org/pkl-pantry/com.github.actions.contrib@1": {
5+
"type": "remote",
6+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions.contrib@1.0.3",
7+
"checksums": {
8+
"sha256": "07b2df92b6c071d773ef66655392ba87bb81d1205cf789965088caf04c0d390e"
9+
}
10+
},
11+
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1": {
12+
"type": "remote",
13+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1.1.0",
14+
"checksums": {
15+
"sha256": "3a6cb486e40fde80dc04ef8c301b957cef12688887a01da3d49d7bba80ee82ef"
16+
}
17+
},
18+
"package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1": {
19+
"type": "remote",
20+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0",
21+
"checksums": {
22+
"sha256": "76174cb974310b3d952280b76ed224eb4ee6fd5419bf696ad9a66fba44bd427d"
23+
}
24+
},
25+
"package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": {
26+
"type": "remote",
27+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1",
28+
"checksums": {
29+
"sha256": "1e6e29b441ffdee2605d317f6543a4a604aab5af472b63f0c47d92a3b4b36f7f"
30+
}
31+
},
32+
"package://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1": {
33+
"type": "remote",
34+
"uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1.0.0",
35+
"checksums": {
36+
"sha256": "cd1cbf67ec77a91d749a6b975509215b4562deea00f1be8f321354bab7f2f1c5"
37+
}
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)