mirror of
https://github.com/gradle/actions.git
synced 2025-04-21 02:09:19 +08:00
Compare commits
No commits in common. "main" and "v3.0.0-beta.1" have entirely different histories.
main
...
v3.0.0-bet
56
.eslintrc.json
Normal file
56
.eslintrc.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"plugins": ["jest", "@typescript-eslint"],
|
||||
"extends": ["plugin:github/recommended"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"rules": {
|
||||
"eslint-comments/no-use": "off",
|
||||
"import/no-namespace": "off",
|
||||
"i18n-text/no-en": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-shadow": "off",
|
||||
"sort-imports": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-shadow": "error",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-var-requires": "error",
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": ["error", {"ignoreStringArrays": true}],
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"semi": "off",
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"jest/globals": true
|
||||
}
|
||||
}
|
17
.github/actions/build-dist/action.yml
vendored
17
.github/actions/build-dist/action.yml
vendored
@ -3,27 +3,14 @@ name: 'Build and upload distribution'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
- name: Build distribution
|
||||
shell: bash
|
||||
run: |
|
||||
npm -v
|
||||
node -v
|
||||
npm install
|
||||
npm run build
|
||||
working-directory: sources
|
||||
|
||||
- name: Copy the generated sources/dist directory to the top-level dist
|
||||
shell: bash
|
||||
run: |
|
||||
cp -r sources/dist .
|
||||
|
||||
- name: Upload distribution
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
|
12
.github/actions/download-dist/action.yml
vendored
Normal file
12
.github/actions/download-dist/action.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
name: 'Download dist'
|
||||
# Downloads a 'dist' directory artifact that was uploaded in an earlier step
|
||||
# We control this with an environment variable to allow for easier global configuration.
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download dist
|
||||
if: ${{ env.DOWNLOAD_DIST == 'true' }}
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
23
.github/actions/init-integ-test/action.yml
vendored
23
.github/actions/init-integ-test/action.yml
vendored
@ -1,23 +0,0 @@
|
||||
name: 'Initialize integ-test'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 11
|
||||
|
||||
- name: Configure environment
|
||||
shell: bash
|
||||
run: |
|
||||
echo "ALLOWED_GRADLE_WRAPPER_CHECKSUMS=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" >> "$GITHUB_ENV"
|
||||
|
||||
# Downloads a 'dist' directory artifact that was uploaded in an earlier 'build-dist' step
|
||||
- name: Download dist
|
||||
if: ${{ env.SKIP_DIST != 'true' && !env.ACT }}
|
||||
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
82
.github/dependabot.yml
vendored
82
.github/dependabot.yml
vendored
@ -5,45 +5,67 @@ registries:
|
||||
url: https://plugins.gradle.org/m2
|
||||
username: dummy # Required by dependabot
|
||||
password: dummy # Required by dependabot
|
||||
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/sources"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
npm-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
# github-actions with directory: "/" only monitors .github/workflows
|
||||
# https://github.com/dependabot/dependabot-core/issues/6345
|
||||
directories:
|
||||
- "/"
|
||||
- "/.github/actions/build-dist"
|
||||
- "/.github/actions/init-integ-test"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
ignore:
|
||||
- dependency-name: "@types/node" # Breaking change: update with next major release
|
||||
- dependency-name: "@octokit/rest" # Tied to node version
|
||||
groups:
|
||||
npm-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "gradle"
|
||||
directories:
|
||||
- ".github/workflow-samples/gradle-plugin"
|
||||
- ".github/workflow-samples/groovy-dsl"
|
||||
- ".github/workflow-samples/java-toolchain"
|
||||
- ".github/workflow-samples/kotlin-dsl"
|
||||
- ".github/workflow-samples/no-wrapper"
|
||||
- ".github/workflow-samples/no-wrapper-gradle-5"
|
||||
- "sources/test/init-scripts"
|
||||
directory: ".github/workflow-samples/gradle-plugin"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
gradle:
|
||||
patterns:
|
||||
- "*"
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: ".github/workflow-samples/groovy-dsl"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: ".github/workflow-samples/java-toolchain"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: ".github/workflow-samples/kotlin-dsl"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: ".github/workflow-samples/no-wrapper"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: ".github/workflow-samples/no-wrapper-gradle-5"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "test/init-scripts"
|
||||
registries:
|
||||
- gradle-plugin-portal
|
||||
schedule:
|
||||
interval: "daily"
|
||||
|
@ -1,2 +0,0 @@
|
||||
# This file was generated by the Gradle 'init' task.
|
||||
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@ -15,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -86,7 +84,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@ -205,7 +203,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
@ -13,8 +13,6 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
@ -59,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
|
60
.github/workflow-samples/gradle-plugin/plugin/build.gradle
vendored
Normal file
60
.github/workflow-samples/gradle-plugin/plugin/build.gradle
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* This generated file contains a sample Gradle plugin project to get you started.
|
||||
* For more details take a look at the Writing Custom Plugins chapter in the Gradle
|
||||
* User Manual available at https://docs.gradle.org/7.3/userguide/custom_plugins.html
|
||||
* This project uses @Incubating APIs which are subject to change.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
// Apply the Java Gradle plugin development plugin to add support for developing Gradle plugins
|
||||
id 'java-gradle-plugin'
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Use Maven Central for resolving dependencies.
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
// Configure the built-in test suite
|
||||
test {
|
||||
// Use JUnit Jupiter test framework
|
||||
useJUnitJupiter('5.7.2')
|
||||
}
|
||||
|
||||
// Create a new test suite
|
||||
functionalTest(JvmTestSuite) {
|
||||
dependencies {
|
||||
// functionalTest test suite depends on the production code in tests
|
||||
implementation(project(':plugin'))
|
||||
}
|
||||
|
||||
targets {
|
||||
all {
|
||||
// This test suite should run after the built-in test suite has run its tests
|
||||
testTask.configure { shouldRunAfter(test) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
// Define the plugin
|
||||
plugins {
|
||||
greeting {
|
||||
id = 'org.example.gradle.plugin.greeting'
|
||||
implementationClass = 'org.example.gradle.plugin.GradlePluginPlugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradlePlugin.testSourceSets(sourceSets.functionalTest)
|
||||
|
||||
tasks.named('check') {
|
||||
// Include functionalTest as part of the check lifecycle
|
||||
dependsOn(testing.suites.functionalTest)
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
plugins {
|
||||
`java-gradle-plugin`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
val test by getting(JvmTestSuite::class) {
|
||||
useJUnitJupiter()
|
||||
}
|
||||
|
||||
val functionalTest by registering(JvmTestSuite::class) {
|
||||
dependencies {
|
||||
implementation(project())
|
||||
}
|
||||
|
||||
targets {
|
||||
all {
|
||||
testTask.configure { shouldRunAfter(test) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
val greeting by plugins.creating {
|
||||
id = "org.example.greeting"
|
||||
implementationClass = "org.example.GradlePluginPlugin"
|
||||
}
|
||||
}
|
||||
|
||||
gradlePlugin.testSourceSets.add(sourceSets["functionalTest"])
|
||||
|
||||
tasks.named<Task>("check") {
|
||||
dependsOn(testing.suites.named("functionalTest"))
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This source file was generated by the Gradle 'init' task
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package org.example;
|
||||
package org.example.gradle.plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -15,7 +15,7 @@ import org.junit.jupiter.api.io.TempDir;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* A simple functional test for the 'org.example.greeting' plugin.
|
||||
* A simple functional test for the 'org.example.gradle.plugin.greeting' plugin.
|
||||
*/
|
||||
class GradlePluginPluginFunctionalTest {
|
||||
@TempDir
|
||||
@ -29,23 +29,24 @@ class GradlePluginPluginFunctionalTest {
|
||||
return new File(projectDir, "settings.gradle");
|
||||
}
|
||||
|
||||
@Test void canRunTask() throws IOException {
|
||||
@Test void canRunTaskWithGradle691() throws IOException {
|
||||
writeString(getSettingsFile(), "");
|
||||
writeString(getBuildFile(),
|
||||
"plugins {" +
|
||||
" id('org.example.greeting')" +
|
||||
" id('org.example.gradle.plugin.greeting')" +
|
||||
"}");
|
||||
|
||||
// Run the build
|
||||
GradleRunner runner = GradleRunner.create();
|
||||
runner.forwardOutput();
|
||||
runner.withGradleVersion("6.9.1");
|
||||
runner.withPluginClasspath();
|
||||
runner.withArguments("greeting");
|
||||
runner.withProjectDir(projectDir);
|
||||
BuildResult result = runner.build();
|
||||
|
||||
// Verify the result
|
||||
assertTrue(result.getOutput().contains("Hello from plugin 'org.example.greeting'"));
|
||||
assertTrue(result.getOutput().contains("Hello from plugin 'org.example.gradle.plugin.greeting'"));
|
||||
}
|
||||
|
||||
private void writeString(File file, String string) throws IOException {
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This source file was generated by the Gradle 'init' task
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package org.example;
|
||||
package org.example.gradle.plugin;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Plugin;
|
||||
@ -13,7 +13,7 @@ public class GradlePluginPlugin implements Plugin<Project> {
|
||||
public void apply(Project project) {
|
||||
// Register a task
|
||||
project.getTasks().register("greeting", task -> {
|
||||
task.doLast(s -> System.out.println("Hello from plugin 'org.example.greeting'"));
|
||||
task.doLast(s -> System.out.println("Hello from plugin 'org.example.gradle.plugin.greeting'"));
|
||||
});
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This source file was generated by the Gradle 'init' task
|
||||
* This Java source file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
package org.example;
|
||||
package org.example.gradle.plugin;
|
||||
|
||||
import org.gradle.testfixtures.ProjectBuilder;
|
||||
import org.gradle.api.Project;
|
||||
@ -9,13 +9,13 @@ import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* A simple unit test for the 'org.example.greeting' plugin.
|
||||
* A simple unit test for the 'org.example.gradle.plugin.greeting' plugin.
|
||||
*/
|
||||
class GradlePluginPluginTest {
|
||||
@Test void pluginRegistersATask() {
|
||||
// Create a test project and apply the plugin
|
||||
Project project = ProjectBuilder.builder().build();
|
||||
project.getPlugins().apply("org.example.greeting");
|
||||
project.getPlugins().apply("org.example.gradle.plugin.greeting");
|
||||
|
||||
// Verify the result
|
||||
assertNotNull(project.getTasks().findByName("greeting"));
|
12
.github/workflow-samples/gradle-plugin/settings.gradle
vendored
Normal file
12
.github/workflow-samples/gradle-plugin/settings.gradle
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
*
|
||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
||||
* in the user manual at https://docs.gradle.org/7.3/userguide/multi_project_builds.html
|
||||
* This project uses @Incubating APIs which are subject to change.
|
||||
*/
|
||||
|
||||
rootProject.name = 'gradle-plugin'
|
||||
include('plugin')
|
@ -1,2 +0,0 @@
|
||||
rootProject.name = "gradle-plugin-2"
|
||||
include("plugin")
|
@ -6,12 +6,8 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
test {
|
||||
useJUnit()
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
testImplementation('junit:junit:4.13.2')
|
||||
}
|
||||
|
||||
tasks.named("test").configure {
|
||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
8
.github/workflow-samples/groovy-dsl/gradlew
vendored
8
.github/workflow-samples/groovy-dsl/gradlew
vendored
@ -15,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -86,7 +84,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@ -205,7 +203,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
22
.github/workflow-samples/groovy-dsl/gradlew.bat
vendored
22
.github/workflow-samples/groovy-dsl/gradlew.bat
vendored
@ -13,8 +13,6 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
@ -59,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
plugins {
|
||||
id "com.gradle.develocity" version "4.0"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.2.1"
|
||||
id "com.gradle.enterprise" version "3.16.1"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.12.1"
|
||||
}
|
||||
|
||||
develocity {
|
||||
gradleEnterprise {
|
||||
buildScan {
|
||||
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
|
||||
termsOfUseAgree = "yes"
|
||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
termsOfServiceAgree = "yes"
|
||||
publishAlways()
|
||||
uploadInBackground = false
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
java
|
||||
id 'java'
|
||||
}
|
||||
|
||||
java {
|
||||
@ -12,10 +12,6 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
val test by getting(JvmTestSuite::class) {
|
||||
useJUnit()
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
testImplementation('junit:junit:4.13.2')
|
||||
}
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@ -15,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -86,7 +84,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@ -205,7 +203,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
@ -13,8 +13,6 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
@ -59,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
|
5
.github/workflow-samples/java-toolchain/settings.gradle
vendored
Normal file
5
.github/workflow-samples/java-toolchain/settings.gradle
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
|
||||
}
|
||||
|
||||
rootProject.name = 'basic'
|
@ -1,6 +0,0 @@
|
||||
plugins {
|
||||
// Apply the foojay-resolver plugin to allow automatic download of JDKs
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
|
||||
}
|
||||
|
||||
rootProject.name = "java-toolchains"
|
@ -8,15 +8,13 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
api("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("com.google.guava:guava:33.4.8-jre")
|
||||
implementation("com.google.guava:guava:33.0.0-jre")
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
|
||||
}
|
||||
|
||||
testing {
|
||||
suites {
|
||||
val test by getting(JvmTestSuite::class) {
|
||||
useJUnitJupiter()
|
||||
}
|
||||
}
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.named("test").configure {
|
||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
8
.github/workflow-samples/kotlin-dsl/gradlew
vendored
8
.github/workflow-samples/kotlin-dsl/gradlew
vendored
@ -15,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -57,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -86,7 +84,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@ -205,7 +203,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
22
.github/workflow-samples/kotlin-dsl/gradlew.bat
vendored
22
.github/workflow-samples/kotlin-dsl/gradlew.bat
vendored
@ -13,8 +13,6 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
@ -59,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
|
@ -1,13 +1,14 @@
|
||||
plugins {
|
||||
id("com.gradle.develocity") version "4.0"
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.2.1"
|
||||
id("com.gradle.enterprise") version "3.16.1"
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.12.1"
|
||||
}
|
||||
|
||||
develocity {
|
||||
gradleEnterprise {
|
||||
buildScan {
|
||||
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
|
||||
termsOfUseAgree = "yes"
|
||||
uploadInBackground = false
|
||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
termsOfServiceAgree = "yes"
|
||||
publishAlways()
|
||||
isUploadInBackground = false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
plugins {
|
||||
id "com.gradle.develocity" version "4.0"
|
||||
id "com.gradle.build-scan" version "3.16.1"
|
||||
}
|
||||
|
||||
develocity {
|
||||
gradleEnterprise {
|
||||
buildScan {
|
||||
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
|
||||
termsOfUseAgree = "yes"
|
||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
termsOfServiceAgree = "yes"
|
||||
publishAlways()
|
||||
uploadInBackground = false
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
plugins {
|
||||
id "com.gradle.develocity" version "4.0"
|
||||
id "com.gradle.enterprise" version "3.16.1"
|
||||
}
|
||||
|
||||
develocity {
|
||||
gradleEnterprise {
|
||||
buildScan {
|
||||
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
|
||||
termsOfUseAgree = "yes"
|
||||
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||
termsOfServiceAgree = "yes"
|
||||
publishAlways()
|
||||
uploadInBackground = false
|
||||
}
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
// Required to keep dependabot happy
|
Binary file not shown.
@ -1,252 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
@ -1,20 +0,0 @@
|
||||
plugins {
|
||||
id "com.gradle.develocity" version "4.0"
|
||||
}
|
||||
|
||||
develocity {
|
||||
buildScan {
|
||||
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
|
||||
termsOfUseAgree = "yes"
|
||||
uploadInBackground = false
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = 'no-wrapper'
|
||||
|
||||
println "Using Gradle version: ${gradle.gradleVersion}"
|
||||
|
||||
def gradleVersionCheck = System.properties.gradleVersionCheck
|
||||
if (gradleVersionCheck && gradle.gradleVersion != gradleVersionCheck) {
|
||||
throw new RuntimeException("Got the wrong version: expected ${gradleVersionCheck} but was ${gradle.gradleVersion}")
|
||||
}
|
57
.github/workflows/ci-check-and-unit-test.yml
vendored
57
.github/workflows/ci-check-and-unit-test.yml
vendored
@ -1,57 +0,0 @@
|
||||
name: CI-check-and-unit-test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'release/**'
|
||||
paths-ignore:
|
||||
- 'dist/**'
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-format-and-unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
- name: Setup Gradle
|
||||
# Use a released version to avoid breakages
|
||||
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
|
||||
env:
|
||||
ALLOWED_GRADLE_WRAPPER_CHECKSUMS: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 # Invalid wrapper jar used for testing
|
||||
with:
|
||||
gradle-version: '8.13'
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: |
|
||||
npm clean-install
|
||||
working-directory: sources
|
||||
|
||||
- name: Check formatting and compile
|
||||
run: |
|
||||
npm run check
|
||||
npm run compile
|
||||
working-directory: sources
|
||||
env:
|
||||
NODE_OPTIONS: '-r @gradle/develocity-agent/preload'
|
||||
DEVELOCITY_URL: 'https://ge.solutions-team.gradle.com'
|
||||
DEVELOCITY_ACCESS_KEY: '${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}'
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
npm test
|
||||
working-directory: sources
|
||||
env:
|
||||
NODE_OPTIONS: '-r @gradle/develocity-agent/preload'
|
||||
DEVELOCITY_URL: 'https://ge.solutions-team.gradle.com'
|
||||
DEVELOCITY_ACCESS_KEY: '${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}'
|
40
.github/workflows/ci-check-no-dist-update.yml
vendored
40
.github/workflows/ci-check-no-dist-update.yml
vendored
@ -1,40 +0,0 @@
|
||||
name: CI-check-no-dist-update
|
||||
|
||||
# Prohibit any change to 'dist/**' on a non-release branch
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'dist/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fail-on-dist-update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
|
||||
with:
|
||||
files: |
|
||||
dist/**
|
||||
|
||||
- name: Print changes to dist directory
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed"
|
||||
done
|
||||
|
||||
- run: |
|
||||
echo "The 'dist' directory is automatically updated by the release process."
|
||||
echo "It should not be updated manually in a non-release branch or a pull request."
|
||||
exit 1
|
56
.github/workflows/ci-codeql.yml
vendored
56
.github/workflows/ci-codeql.yml
vendored
@ -1,20 +1,25 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: CI-codeql
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'release/**'
|
||||
- 'dev/**' # Allow running Code QL on dev branches without a PR
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '25 23 * * 2'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
@ -27,20 +32,39 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript-typescript' ]
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
config: |
|
||||
paths:
|
||||
- sources/src
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
24
.github/workflows/ci-combine-bot-prs.yml
vendored
24
.github/workflows/ci-combine-bot-prs.yml
vendored
@ -1,24 +0,0 @@
|
||||
name: Combine Bot PRs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
combine-wrapperbot-prs:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
checks: read
|
||||
if: github.repository == 'gradle/actions'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: combine-wrapperbot-prs
|
||||
uses: github/combine-prs@2909f404763c3177a456e052bdb7f2e85d3a7cb3 # v5.2.0
|
||||
with:
|
||||
branch_prefix: wrapperbot
|
||||
combine_branch_name: wrapperbot/combined-wrapper-updates
|
||||
pr_title: 'Bump Gradle Wrappers'
|
||||
ci_required: "false"
|
20
.github/workflows/ci-dependency-review.yml
vendored
Normal file
20
.github/workflows/ci-dependency-review.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# Dependency Review Action
|
||||
#
|
||||
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
|
||||
#
|
||||
# Source repository: https://github.com/actions/dependency-review-action
|
||||
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
||||
name: CI-dependency-review
|
||||
on: [pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@v4
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@v3
|
97
.github/workflows/ci-full-check.yml
vendored
Normal file
97
.github/workflows/ci-full-check.yml
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
name: CI-full-check
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
- review_requested
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- '.github/**'
|
||||
- 'dist/**'
|
||||
|
||||
jobs:
|
||||
action-inputs:
|
||||
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
cache-cleanup:
|
||||
uses: ./.github/workflows/integ-test-cache-cleanup.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
caching-config:
|
||||
uses: ./.github/workflows/integ-test-caching-config.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
dependency-graph:
|
||||
uses: ./.github/workflows/integ-test-dependency-graph.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
execution-with-caching:
|
||||
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
execution:
|
||||
uses: ./.github/workflows/integ-test-execution.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
gradle-enterprise-injection:
|
||||
uses: ./.github/workflows/integ-test-inject-gradle-enterprise.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
secrets:
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
|
||||
|
||||
provision-gradle-versions:
|
||||
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
# restore-configuration-cache:
|
||||
# uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||
# with:
|
||||
# cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
restore-custom-gradle-home:
|
||||
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
restore-containerized-gradle-home:
|
||||
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
restore-gradle-home:
|
||||
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
restore-java-toolchain:
|
||||
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
sample-kotlin-dsl:
|
||||
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
sample-gradle-plugin:
|
||||
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
||||
|
||||
toolchain-detection:
|
||||
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
|
||||
with:
|
||||
cache-key-prefix: ${{github.run_number}}-
|
26
.github/workflows/ci-init-script-check.yml
vendored
26
.github/workflows/ci-init-script-check.yml
vendored
@ -2,37 +2,25 @@ name: CI-init-script-check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'release/**'
|
||||
paths-ignore:
|
||||
- 'dist/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/ci-init-script-check.yml'
|
||||
- 'sources/src/resources/init-scripts/**'
|
||||
- 'sources/test/init-scripts/**'
|
||||
- 'src/resources/init-scripts/**'
|
||||
- 'test/init-scripts/**'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-init-scripts:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 11
|
||||
java-version: 8
|
||||
- name: Setup Gradle
|
||||
# Use a released version to avoid breakages
|
||||
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
|
||||
env:
|
||||
ALLOWED_GRADLE_WRAPPER_CHECKSUMS: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 # Invalid wrapper jar used for testing
|
||||
uses: gradle/gradle-build-action@v2.11.0 # Use a released version to avoid breakages
|
||||
- name: Run integration tests
|
||||
working-directory: sources/test/init-scripts
|
||||
working-directory: test/init-scripts
|
||||
run: ./gradlew check
|
||||
|
39
.github/workflows/ci-integ-test-full.yml
vendored
39
.github/workflows/ci-integ-test-full.yml
vendored
@ -1,39 +0,0 @@
|
||||
name: CI-integ-test-full
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
- 'dist/**'
|
||||
|
||||
concurrency:
|
||||
group: integ-test
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
caching-integ-tests:
|
||||
uses: ./.github/workflows/suite-integ-test-caching.yml
|
||||
concurrency:
|
||||
group: CI-integ-test-full
|
||||
cancel-in-progress: false
|
||||
with:
|
||||
runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
skip-dist: true
|
||||
secrets: inherit
|
||||
|
||||
other-integ-tests:
|
||||
permissions:
|
||||
contents: write
|
||||
uses: ./.github/workflows/suite-integ-test-other.yml
|
||||
concurrency:
|
||||
group: CI-integ-test-full
|
||||
cancel-in-progress: false
|
||||
with:
|
||||
runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
skip-dist: true
|
||||
secrets: inherit
|
45
.github/workflows/ci-integ-test.yml
vendored
45
.github/workflows/ci-integ-test.yml
vendored
@ -1,45 +0,0 @@
|
||||
name: CI-integ-test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'release/**'
|
||||
- 'dev/**' # Allow running tests on dev branches without a PR
|
||||
paths-ignore:
|
||||
- 'dist/**'
|
||||
|
||||
concurrency:
|
||||
group: integ-test
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-distribution:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Build and upload distribution
|
||||
if: ${{ needs.determine-suite.outputs.suite != 'full' }}
|
||||
uses: ./.github/actions/build-dist
|
||||
|
||||
caching-integ-tests:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/suite-integ-test-caching.yml
|
||||
with:
|
||||
skip-dist: false
|
||||
secrets: inherit
|
||||
|
||||
other-integ-tests:
|
||||
permissions:
|
||||
contents: write
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/suite-integ-test-other.yml
|
||||
with:
|
||||
skip-dist: false
|
||||
secrets: inherit
|
57
.github/workflows/ci-ossf-scorecard.yml
vendored
57
.github/workflows/ci-ossf-scorecard.yml
vendored
@ -1,57 +0,0 @@
|
||||
name: CI-ossf-scorecard
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 5 * * 1'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecard analysis
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Needed to publish results and get a badge (see publish_results below).
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: 'Checkout code'
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
show-progress: false
|
||||
|
||||
- name: 'Run analysis'
|
||||
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
||||
# Public repositories:
|
||||
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||
# - Allows the repository to include the Scorecard badge.
|
||||
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories:
|
||||
# - `publish_results` will always be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: 'Upload artifact'
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: 'Upload to code-scanning'
|
||||
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
|
||||
with:
|
||||
sarif_file: results.sarif
|
142
.github/workflows/ci-quick-check.yml
vendored
Normal file
142
.github/workflows/ci-quick-check.yml
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
name: CI-quick-check
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches-ignore: main
|
||||
|
||||
jobs:
|
||||
build-distribution:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and upload distribution
|
||||
uses: ./.github/actions/build-dist
|
||||
|
||||
run-unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Configure Gradle as default for unit test
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: 8.5
|
||||
- name: Run tests
|
||||
run: |
|
||||
npm install
|
||||
npm run all
|
||||
|
||||
action-inputs:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
cache-cleanup:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-cache-cleanup.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
cache-key-prefix: ${{github.run_number}}- # Requires a fresh cache entry each run
|
||||
|
||||
caching-config:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-caching-config.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
dependency-graph:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-dependency-graph.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
execution-with-caching:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
execution:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-execution.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
gradle-enterprise-injection:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-inject-gradle-enterprise.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
secrets:
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
|
||||
|
||||
provision-gradle-versions:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
restore-configuration-cache:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
restore-containerized-gradle-home:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
||||
with:
|
||||
download-dist: true
|
||||
|
||||
restore-custom-gradle-home:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||
with:
|
||||
download-dist: true
|
||||
|
||||
restore-gradle-home:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
restore-java-toolchain:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
sample-kotlin-dsl:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
sample-gradle-plugin:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
||||
|
||||
toolchain-detection:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
|
||||
with:
|
||||
runner-os: '["ubuntu-latest"]'
|
||||
download-dist: true
|
75
.github/workflows/ci-update-dist.yml
vendored
75
.github/workflows/ci-update-dist.yml
vendored
@ -1,75 +0,0 @@
|
||||
name: CI-update-dist
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'prerelease/**'
|
||||
- 'release/**'
|
||||
paths-ignore:
|
||||
- 'dist/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-dist:
|
||||
# Only run for the Gradle repository; otherwise when users create pull requests from their `main` branch
|
||||
# it would erroneously update `dist` on their branch (and the pull request)
|
||||
if: github.repository == 'gradle/actions'
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: |
|
||||
npm clean-install
|
||||
working-directory: sources
|
||||
|
||||
- name: Build distribution
|
||||
run: |
|
||||
npm run check
|
||||
npm run compile
|
||||
working-directory: sources
|
||||
env:
|
||||
NODE_OPTIONS: '-r @gradle/develocity-agent/preload'
|
||||
DEVELOCITY_URL: 'https://ge.solutions-team.gradle.com'
|
||||
DEVELOCITY_ACCESS_KEY: '${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}'
|
||||
|
||||
- name: Copy the generated sources/dist directory to the top-level dist
|
||||
run: |
|
||||
cp -r sources/dist .
|
||||
|
||||
- name: Import GPG key to sign commits
|
||||
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GH_BOT_PGP_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GH_BOT_PGP_PASSPHRASE }}
|
||||
git_user_signingkey: true
|
||||
git_commit_gpgsign: true
|
||||
git_config_global: true
|
||||
|
||||
# Commit and push changes; has no effect if the files did not change
|
||||
# Important: The push event will not trigger any other workflows, see
|
||||
# https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#commits-made-by-this-action-do-not-trigger-new-workflow-runs
|
||||
- name: Commit & push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # v5.1.0
|
||||
with:
|
||||
commit_author: bot-githubaction <bot-githubaction@gradle.com>
|
||||
commit_user_name: bot-githubaction
|
||||
commit_user_email: bot-githubaction@gradle.com
|
||||
commit_message: '[bot] Update dist directory'
|
||||
file_pattern: dist
|
17
.github/workflows/ci-validate-wrappers.yml
vendored
17
.github/workflows/ci-validate-wrappers.yml
vendored
@ -1,17 +0,0 @@
|
||||
name: CI-validate-wrappers
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: gradle/actions/wrapper-validation@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
|
||||
with:
|
||||
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
40
.github/workflows/ci-verify-outputs.yml
vendored
Normal file
40
.github/workflows/ci-verify-outputs.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
name: CI-verify-outputs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
- review_requested
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dependabot/**
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: |
|
||||
npm -v
|
||||
node -v
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Compare the expected and actual dist/ directories
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build. See status below:"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
id: diff
|
||||
|
||||
# If index.js was different than expected, upload the expected version as an artifact
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
43
.github/workflows/demo-failure-cases.yml
vendored
Normal file
43
.github/workflows/demo-failure-cases.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: demo-failure-cases
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
failing-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Test build failure
|
||||
uses: ./
|
||||
continue-on-error: true
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/kotlin-dsl
|
||||
arguments: not-a-valid-task
|
||||
|
||||
wrapper-missing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Test wrapper missing
|
||||
uses: ./
|
||||
continue-on-error: true
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/no-wrapper
|
||||
arguments: help
|
||||
|
||||
bad-configuration:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Test bad config value
|
||||
uses: ./
|
||||
continue-on-error: true
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/no-wrapper
|
||||
arguments: help
|
||||
cache-disabled: yes
|
87
.github/workflows/demo-job-summary.yml
vendored
87
.github/workflows/demo-job-summary.yml
vendored
@ -2,33 +2,24 @@ name: Demo Job Summary, for Gradle builds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
build-distribution:
|
||||
run-gradle-builds:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Build and upload distribution
|
||||
uses: ./.github/actions/build-dist
|
||||
|
||||
many-gradle-builds:
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Build distribution
|
||||
shell: bash
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false
|
||||
cache-cleanup: 'on-success'
|
||||
uses: ./
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew assemble
|
||||
@ -46,46 +37,21 @@ jobs:
|
||||
run: |
|
||||
./gradlew tasks --no-daemon
|
||||
./gradlew help check
|
||||
./gradlew wrapper --gradle-version 8.7 --gradle-distribution-sha256-sum 544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d
|
||||
- name: Fail groovy-dsl project
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
continue-on-error: true
|
||||
run: ./gradlew not-a-real-task
|
||||
- name: Dependency submission
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
dependency-graph: generate-and-upload
|
||||
|
||||
successful-builds-with-no-summary:
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
add-job-summary: on-failure
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew assemble
|
||||
- name: Build kotlin-dsl project without Build Scan®
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew assemble check --no-scan
|
||||
|
||||
pre-existing-gradle-home:
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Build distribution
|
||||
shell: bash
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
- name: Pre-create Gradle User Home
|
||||
shell: bash
|
||||
run: |
|
||||
@ -93,24 +59,7 @@ jobs:
|
||||
mkdir ~/.gradle/caches
|
||||
touch ~/.gradle/caches/dummy.txt
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
- name: Run build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: ./gradlew assemble
|
||||
|
||||
cache-read-only:
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew assemble
|
||||
|
78
.github/workflows/demo-pr-build-scan-comment.yml
vendored
78
.github/workflows/demo-pr-build-scan-comment.yml
vendored
@ -2,76 +2,26 @@ name: Demo adding Build Scan® comment to PR
|
||||
on:
|
||||
pull_request:
|
||||
types: [assigned, review_requested]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-distribution:
|
||||
gradle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Build and upload distribution
|
||||
uses: ./.github/actions/build-dist
|
||||
|
||||
successful-build-with-always-comment:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Checkout project sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
add-job-summary-as-pr-comment: always
|
||||
uses: ./
|
||||
- name: Run build with Gradle wrapper
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew build --scan
|
||||
|
||||
successful-build-with-comment-on-failure:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
- name: "Add Build Scan URL as PR comment"
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
add-job-summary-as-pr-comment: on-failure
|
||||
- name: Run build with Gradle wrapper
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew build --scan
|
||||
|
||||
failing-build-with-comment-on-failure:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
needs: build-distribution
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
add-job-summary-as-pr-comment: on-failure
|
||||
- name: Run build with Gradle wrapper
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew no-a-real-task --scan
|
||||
continue-on-error: true
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'PR ready for review: ${{ steps.gradle.outputs.build-scan-url }}'
|
||||
})
|
||||
|
41
.github/workflows/integ-test-action-inputs.yml
vendored
Normal file
41
.github/workflows/integ-test-action-inputs.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: Test action inputs
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
action-inputs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Invoke with multi-line arguments
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
arguments: |
|
||||
--configuration-cache
|
||||
--build-cache
|
||||
-DsystemProperty=FOO
|
||||
-PgradleProperty=BAR
|
||||
test
|
||||
jar
|
@ -1,56 +0,0 @@
|
||||
name: Test develocity injection
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: build-scan-publish-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-scan-publish:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gradle: ['current', '7.6.2', '6.9.4', '5.6.4']
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
build-scan-publish: true
|
||||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-ge
|
||||
run: gradle help
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
80
.github/workflows/integ-test-cache-cleanup.yml
vendored
80
.github/workflows/integ-test-cache-cleanup.yml
vendored
@ -5,103 +5,83 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
# Requires a fresh cache entry each run
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: cache-cleanup-${{ inputs.cache-key-prefix }}-${{github.run_number}}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: integ-test-cache-cleanup-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
cache-cleanup-full-build:
|
||||
full-build:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build with 3.1
|
||||
working-directory: sources/test/jest/resources/cache-cleanup
|
||||
run: ./gradlew --no-daemon --build-cache -Dcommons_math3_version="3.1" build
|
||||
working-directory: test/jest/resources/cache-cleanup
|
||||
run: gradle --no-daemon --build-cache -Dcommons_math3_version="3.1" build
|
||||
|
||||
# Second build will use the cache from the first build, but cleanup should remove unused artifacts
|
||||
cache-cleanup-assemble-build:
|
||||
needs: cache-cleanup-full-build
|
||||
assemble-build:
|
||||
needs: full-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false
|
||||
cache-cleanup: 'on-success'
|
||||
gradle-home-cache-cleanup: true
|
||||
- name: Build with 3.1.1
|
||||
working-directory: sources/test/jest/resources/cache-cleanup
|
||||
run: ./gradlew --no-daemon --build-cache -Dcommons_math3_version="3.1.1" build
|
||||
working-directory: test/jest/resources/cache-cleanup
|
||||
run: gradle --no-daemon --build-cache -Dcommons_math3_version="3.1.1" build
|
||||
|
||||
cache-cleanup-check-clean-cache:
|
||||
needs: cache-cleanup-assemble-build
|
||||
check-clean-cache:
|
||||
needs: assemble-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Report Gradle User Home
|
||||
shell: bash
|
||||
run: |
|
||||
du -hc $GRADLE_USER_HOME/caches/modules-2
|
||||
du -hc $GRADLE_USER_HOME/wrapper/dists
|
||||
run: du -hc ~/.gradle/caches/modules-2
|
||||
- name: Verify cleaned cache
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -e $GRADLE_USER_HOME/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1.1 ]; then
|
||||
if [ ! -e ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1.1 ]; then
|
||||
echo "::error ::Should find commons-math3 3.1.1 in cache"
|
||||
exit 1
|
||||
fi
|
||||
if [ -e $GRADLE_USER_HOME/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1 ]; then
|
||||
if [ -e ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1 ]; then
|
||||
echo "::error ::Should NOT find commons-math3 3.1 in cache"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e $GRADLE_USER_HOME/wrapper/dists/gradle-8.0.2-bin ]; then
|
||||
echo "::error ::Should find gradle-8.0.2 in wrapper/dists"
|
||||
exit 1
|
||||
fi
|
||||
|
121
.github/workflows/integ-test-caching-config.yml
vendored
121
.github/workflows/integ-test-caching-config.yml
vendored
@ -5,43 +5,37 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-caching-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
caching-config-seed-build:
|
||||
seed-build:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
# Add "application" to main cache entry but omit "notifications"
|
||||
# Add "enterprise" to main cache entry but omit "notifications"
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
application
|
||||
enterprise
|
||||
# Exclude build-cache from main cache entry
|
||||
gradle-home-cache-excludes: |
|
||||
caches/build-cache-*
|
||||
@ -51,27 +45,24 @@ jobs:
|
||||
run: ./gradlew test
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
caching-config-verify-build:
|
||||
needs: caching-config-seed-build
|
||||
verify-build:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
# Use the same configuration as used in the seed build
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
application
|
||||
enterprise
|
||||
gradle-home-cache-excludes: |
|
||||
caches/build-cache-*
|
||||
caches/*/executionHistory
|
||||
@ -81,100 +72,90 @@ jobs:
|
||||
run: ./gradlew test --offline
|
||||
|
||||
# Test that build scans are captured when caching is explicitly disabled
|
||||
caching-config-cache-disabled:
|
||||
cache-disabled:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-disabled: true
|
||||
- name: Build using Gradle wrapper
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: ./gradlew help
|
||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check Build Scan url is captured
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
|
||||
caching-config-cache-disabled-pre-existing-gradle-home:
|
||||
runs-on: ubuntu-latest # This test only runs on Ubuntu
|
||||
cache-disabled-pre-existing-gradle-home:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Create dummy Gradle User Home
|
||||
run: mkdir -p ~/.gradle/caches
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
- name: Build using Gradle wrapper
|
||||
uses: ./
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: ./gradlew help
|
||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check Build Scan url is captured
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
# Test seed the cache with cache-write-only and verify with cache-read-only
|
||||
caching-config-seed-write-only:
|
||||
seed-build-write-only:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-write-only-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only-
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-write-only: true
|
||||
- name: Build using Gradle wrapper
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: ./gradlew test
|
||||
|
||||
caching-config-verify-write-only:
|
||||
verify-write-only-build:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-write-only-${{ inputs.cache-key-prefix }}
|
||||
needs: caching-config-seed-write-only
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only-
|
||||
needs: seed-build-write-only
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
|
175
.github/workflows/integ-test-dependency-graph.yml
vendored
175
.github/workflows/integ-test-dependency-graph.yml
vendored
@ -5,87 +5,80 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
|
||||
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
dependency-graph-groovy-upload:
|
||||
runs-on: "ubuntu-latest"
|
||||
groovy-generate:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle for dependency-graph generate
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
dependency-graph: generate-and-upload
|
||||
- name: Run gradle build
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
|
||||
dependency-graph-groovy-submit:
|
||||
permissions:
|
||||
contents: write
|
||||
needs: [dependency-graph-groovy-upload]
|
||||
runs-on: "ubuntu-latest"
|
||||
kotlin-generate:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Submit dependency graphs
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
dependency-graph: download-and-submit
|
||||
env:
|
||||
DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-upload
|
||||
|
||||
dependency-graph-kotlin-generate-and-submit:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle for dependency-graph generate
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run gradle build
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
|
||||
dependency-graph-multiple-builds:
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
submit:
|
||||
needs: [groovy-generate]
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Submit dependency graphs
|
||||
uses: ./
|
||||
with:
|
||||
dependency-graph: download-and-submit
|
||||
|
||||
multiple-builds:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle for dependency-graph generate
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- id: gradle-assemble
|
||||
@ -94,15 +87,11 @@ jobs:
|
||||
- id: gradle-build
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- id: gradle-build-again
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check generated dependency graphs
|
||||
shell: bash
|
||||
run: |
|
||||
echo "gradle-assemble report file: ${{ steps.gradle-assemble.outputs.dependency-graph-file }}"
|
||||
echo "gradle-build report file: ${{ steps.gradle-build.outputs.dependency-graph-file }}"
|
||||
echo "gradle-build-again report file: ${{ steps.gradle-build-again.outputs.dependency-graph-file }}"
|
||||
ls -l dependency-graph-reports
|
||||
if [ ! -e "${{ steps.gradle-assemble.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find gradle-assemble dependency graph file"
|
||||
@ -112,81 +101,3 @@ jobs:
|
||||
echo "Did not find gradle-build dependency graph files"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e "${{ steps.gradle-build-again.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find gradle-build-again dependency graph files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-graph-config-cache:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest # Test is not compatible with Windows
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle for dependency-graph generate
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- id: config-cache-store
|
||||
run: ./gradlew assemble --configuration-cache
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check and delete generated dependency graph
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -e "${{ steps.config-cache-store.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find config-cache-store dependency graph files"
|
||||
exit 1
|
||||
fi
|
||||
rm ${{ steps.config-cache-store.outputs.dependency-graph-file }}
|
||||
- id: config-cache-reuse
|
||||
run: ./gradlew assemble --configuration-cache
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check no dependency graph is generated
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
||||
echo "Expected no dependency graph files to be generated"
|
||||
ls -l dependency-graph-reports
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-graph-generate-submit-and-upload:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle for dependency-graph generate
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
dependency-graph: generate-submit-and-upload
|
||||
- name: Run gradle build
|
||||
id: gradle-build
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
|
||||
dependency-graph-generate-submit-and-upload-check:
|
||||
needs: [dependency-graph-generate-submit-and-upload]
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Download dependency-graph artifact
|
||||
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
|
||||
with:
|
||||
path: downloaded-dependency-graphs
|
||||
pattern: dependency-graph_*dependency-graph-generate-submit-and-upload.json
|
||||
- name: Check for downloaded dependency graphs
|
||||
shell: bash
|
||||
run: |
|
||||
ls -A "${{ github.workspace }}/downloaded-dependency-graphs"
|
||||
if [ -z "$(ls -A "${{ github.workspace }}/downloaded-dependency-graphs")" ]; then
|
||||
echo "No dependency graph files found"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1,103 +0,0 @@
|
||||
name: Test dependency submission failures
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-submission-failures-${{ inputs.cache-key-prefix }}
|
||||
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
dependency-submission-failures-failing-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Submit with failing build
|
||||
id: gradle-build
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
additional-arguments: fail
|
||||
continue-on-error: true
|
||||
- name: Check step failed
|
||||
if: steps.gradle-build.outcome != 'failure'
|
||||
run: |
|
||||
echo "Expected dependency submission step to fail"
|
||||
exit 1
|
||||
- name: Check no dependency graph is generated
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
||||
echo "Expected no dependency graph files to be generated"
|
||||
ls -l dependency-graph-reports
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-submission-failures-unsupported-gradle-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Submit with unsupported Gradle version
|
||||
id: gradle-build
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
gradle-version: '7.0.1'
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
continue-on-error: true
|
||||
- name: Check step failed
|
||||
if: steps.gradle-build.outcome != 'failure'
|
||||
run: |
|
||||
echo "Expected dependency submission step to fail"
|
||||
exit 1
|
||||
- name: Check no dependency graph is generated
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
||||
echo "Expected no dependency graph files to be generated"
|
||||
ls -l dependency-graph-reports
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-submission-failures-insufficient-permissions:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Submit with insufficient permissions
|
||||
id: gradle-build
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
continue-on-error: true
|
||||
- name: Check step failed
|
||||
if: steps.gradle-build.outcome != 'failure'
|
||||
run: |
|
||||
echo "Expected dependency submission step to fail"
|
||||
exit 1
|
@ -1,407 +0,0 @@
|
||||
name: Test dependency submission
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-submission-${{ inputs.cache-key-prefix }}
|
||||
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
dependency-submission-groovy-generate-and-upload:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Generate dependency graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: generate-and-upload
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
cache-read-only: false
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: groovy-dependency-submission
|
||||
|
||||
dependency-submission-groovy-restore-cache:
|
||||
permissions:
|
||||
contents: write
|
||||
needs: [dependency-submission-groovy-generate-and-upload]
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Restore dependency graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
additional-arguments: --offline
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: groovy-dependency-submission
|
||||
|
||||
dependency-submission-groovy-download-and-submit:
|
||||
permissions:
|
||||
contents: write
|
||||
needs: [dependency-submission-groovy-generate-and-upload]
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Submit dependency graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: download-and-submit
|
||||
env:
|
||||
DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-generate-and-upload-${{ matrix.os }}
|
||||
|
||||
dependency-submission-kotlin-generate-and-submit:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Generate and submit dependency graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/kotlin-dsl
|
||||
|
||||
dependency-submission-multiple-builds:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- id: kotlin-dsl
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/kotlin-dsl
|
||||
- id: groovy-dsl
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
- id: groovy-dsl-again
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
dependency-resolution-task: assemble
|
||||
- name: Check generated dependency graphs
|
||||
shell: bash
|
||||
run: |
|
||||
echo "kotlin-dsl report file: ${{ steps.kotlin-dsl.outputs.dependency-graph-file }}"
|
||||
echo "groovy-dsl report file: ${{ steps.groovy-dsl.outputs.dependency-graph-file }}"
|
||||
echo "groovy-dsl-again report file: ${{ steps.groovy-dsl-again.outputs.dependency-graph-file }}"
|
||||
ls -l dependency-graph-reports
|
||||
if [ ! -e "${{ steps.kotlin-dsl.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find kotlin-dsl dependency graph file"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e "${{ steps.groovy-dsl.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find groovy-dsl dependency graph file"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e "${{ steps.groovy-dsl-again.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find groovy-dsl-again dependency graph file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-submission-multiple-builds-upload:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- id: kotlin-dsl
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: generate-and-upload
|
||||
build-root-directory: .github/workflow-samples/kotlin-dsl
|
||||
- id: groovy-dsl
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: generate-and-upload
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
|
||||
dependency-submission-config-cache:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest # Test is not compatible with Windows
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- id: config-cache-store
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
additional-arguments: --configuration-cache
|
||||
- name: Check and delete generated dependency graph
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -e "${{ steps.config-cache-store.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find config-cache-store dependency graph files"
|
||||
exit 1
|
||||
fi
|
||||
rm ${{ steps.config-cache-store.outputs.dependency-graph-file }}*
|
||||
- id: config-cache-reuse
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
additional-arguments: --configuration-cache
|
||||
- name: Check no dependency graph is generated
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
||||
echo "Expected no dependency graph files to be generated"
|
||||
ls -l dependency-graph-reports
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-submission-gradle-versions:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
gradle: ['8.0.2', '7.6.4', '7.1.1', '6.9.4', '6.0.1', '5.6.4', '5.2.1']
|
||||
include:
|
||||
- gradle: '5.6.4'
|
||||
build-root-suffix: -gradle-5
|
||||
- gradle: '5.2.1'
|
||||
build-root-suffix: -gradle-5
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Generate and submit dependencies
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
|
||||
dependency-submission-with-setup-gradle:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest # Test is not compatible with Windows
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
- name: Generate and submit dependencies
|
||||
id: dependency-submission
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check and delete generated dependency graph
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -e "${{ steps.dependency-submission.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find generated dependency graph files"
|
||||
exit 1
|
||||
fi
|
||||
rm ${{ steps.dependency-submission.outputs.dependency-graph-file }}*
|
||||
- name: Run Gradle build
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check no dependency graph is generated
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -z "$(ls -A dependency-graph-reports)" ]; then
|
||||
echo "Expected no dependency graph files to be generated"
|
||||
ls -l dependency-graph-reports
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-submission-with-includes-and-excludes:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest # Test is not compatible with Windows
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Generate and submit dependencies
|
||||
id: dependency-submission
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
dependency-graph-exclude-projects: excluded-project
|
||||
dependency-graph-include-projects: included-project
|
||||
dependency-graph-exclude-configurations: excluded-configuration
|
||||
dependency-graph-include-configurations: included-configuration
|
||||
- name: Check generated dependency graph and env vars
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -e "${{ steps.dependency-submission.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find generated dependency graph file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$DEPENDENCY_GRAPH_EXCLUDE_PROJECTS" != "excluded-project" ] ||
|
||||
[ "$DEPENDENCY_GRAPH_INCLUDE_PROJECTS" != "included-project" ] ||
|
||||
[ "$DEPENDENCY_GRAPH_EXCLUDE_CONFIGURATIONS" != "excluded-configuration" ] ||
|
||||
[ "$DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS" != "included-configuration" ]; then
|
||||
echo "Did not set expected environment variables"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
dependency-submission-custom-report-dir-submit:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Generate dependency graph
|
||||
id: dependency-graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
dependency-graph-report-dir: '${{ github.workspace }}/custom/report-dir'
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check generated dependency graphs
|
||||
shell: bash
|
||||
run: |
|
||||
echo "report file: ${{ steps.dependency-graph.outputs.dependency-graph-file }}"
|
||||
|
||||
if [ ! -e "${{ steps.dependency-graph.outputs.dependency-graph-file }}" ]; then
|
||||
echo "Did not find dependency graph file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$(ls -A "${{ github.workspace }}/custom/report-dir")" ]; then
|
||||
echo "No dependency graph files found in custom directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependency-submission-custom-report-dir-upload:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Generate and upload dependency graph
|
||||
id: dependency-graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: generate-and-upload
|
||||
dependency-graph-report-dir: '${{ github.workspace }}/custom/report-dir'
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
|
||||
custom-report-dir-download-and-submit:
|
||||
permissions:
|
||||
contents: write
|
||||
needs: [dependency-submission-custom-report-dir-upload]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Download and submit dependency graph
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
dependency-graph: download-and-submit
|
||||
dependency-graph-report-dir: '${{ github.workspace }}/custom/report-dir'
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
env:
|
||||
DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: custom-report-dir-upload # For testing, to avoid downloading artifacts from other worklfows
|
||||
|
||||
- name: Check downloaded dependency graph
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -z "$(ls -A "${{ github.workspace }}/custom/report-dir")" ]; then
|
||||
echo "No dependency graph files found in custom directory"
|
||||
exit 1
|
||||
fi
|
@ -5,42 +5,37 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: detect-java-toolchain-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
# Test that pre-installed runner JDKs are detected
|
||||
detect-toolchains-pre-installed-jdks:
|
||||
pre-installed-toolchains:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
- name: List detected toolchains
|
||||
shell: bash
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: |
|
||||
./gradlew --info javaToolchains > output.txt
|
||||
gradle -q javaToolchains > output.txt
|
||||
cat output.txt
|
||||
- name: Verify detected toolchains
|
||||
shell: bash
|
||||
@ -49,50 +44,70 @@ jobs:
|
||||
grep -q 'Eclipse Temurin JDK 1.8' output.txt || (echo "::error::Did not detect preinstalled JDK 1.8" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 11' output.txt || (echo "::error::Did not detect preinstalled JDK 11" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 17' output.txt || (echo "::error::Did not detect preinstalled JDK 17" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 21' output.txt || (echo "::error::Did not detect preinstalled JDK 21" && exit 1)
|
||||
|
||||
# Test that JDKs provisioned by setup-java are detected
|
||||
detect-toolchains-setup-java-jdks:
|
||||
setup-java-installed-toolchain:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Java 20
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 20
|
||||
java-version: '20'
|
||||
- name: Setup Java 16
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 16
|
||||
java-version: '16'
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
- name: List detected toolchains
|
||||
shell: bash
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: |
|
||||
./gradlew --info javaToolchains > output.txt
|
||||
gradle -q javaToolchains > output.txt
|
||||
cat output.txt
|
||||
- name: Verify setup JDKs are detected
|
||||
- name: Verify detected toolchains
|
||||
shell: bash
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: |
|
||||
grep -q 'Eclipse Temurin JDK 16' output.txt || (echo "::error::Did not detect setup-java installed JDK 16" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 20' output.txt || (echo "::error::Did not detect setup-java installed JDK 20" && exit 1)
|
||||
- name: Verify pre-installed toolchains are detected
|
||||
|
||||
# Test that predefined JDK detection property is not overwritten by action
|
||||
check-no-overwrite:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Configure java installations env var in Gradle User Home
|
||||
shell: bash
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: |
|
||||
grep -q 'Eclipse Temurin JDK 1.8' output.txt || (echo "::error::Did not detect preinstalled JDK 1.8" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 11' output.txt || (echo "::error::Did not detect preinstalled JDK 11" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 17' output.txt || (echo "::error::Did not detect preinstalled JDK 17" && exit 1)
|
||||
grep -q 'Eclipse Temurin JDK 21' output.txt || (echo "::error::Did not detect preinstalled JDK 21" && exit 1)
|
||||
mkdir -p ~/.gradle
|
||||
echo "org.gradle.java.installations.fromEnv=XXXXX" > ~/.gradle/gradle.properties
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
- name: Check gradle.properties
|
||||
shell: bash
|
||||
run: |
|
||||
cat ~/.gradle/gradle.properties
|
||||
if grep -q 'org.gradle.java.installations.fromEnv=JAVA_HOME' ~/.gradle/gradle.properties ; then
|
||||
echo 'Found overwritten fromEnv'
|
||||
exit 1
|
||||
fi
|
||||
if ! grep -q 'org.gradle.java.installations.fromEnv=XXXXX' ~/.gradle/gradle.properties ; then
|
||||
echo 'Did NOT find original fromEnv'
|
||||
exit 1
|
||||
fi
|
56
.github/workflows/integ-test-execution-with-caching.yml
vendored
Normal file
56
.github/workflows/integ-test-execution-with-caching.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: Test execution with caching
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
seed-build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Execute Gradle build
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
arguments: test
|
||||
|
||||
# Test that the gradle-user-home is restored
|
||||
verify-build:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Execute Gradle build
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
arguments: test --offline -DverifyCachedBuild=true
|
||||
|
94
.github/workflows/integ-test-execution.yml
vendored
Normal file
94
.github/workflows/integ-test-execution.yml
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
name: Test execution
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
# Tests for executing with different Gradle versions.
|
||||
# Each build verifies that it is executed with the expected Gradle version.
|
||||
gradle-execution:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
include:
|
||||
- os: windows-latest
|
||||
script-suffix: '.bat'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Test use defined Gradle version
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: 6.9
|
||||
build-root-directory: .github/workflow-samples/no-wrapper
|
||||
arguments: help -DgradleVersionCheck=6.9
|
||||
- name: Test use Gradle version alias
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: release-candidate
|
||||
build-root-directory: .github/workflow-samples/no-wrapper
|
||||
arguments: help
|
||||
- name: Test use defined Gradle executable
|
||||
uses: ./
|
||||
with:
|
||||
gradle-executable: .github/workflow-samples/groovy-dsl/gradlew${{ matrix.script-suffix }}
|
||||
build-root-directory: .github/workflow-samples/no-wrapper
|
||||
arguments: help
|
||||
|
||||
gradle-versions:
|
||||
strategy:
|
||||
matrix:
|
||||
gradle: [7.5.1, 6.9.2, 5.6.4, 4.10.3, 3.5.1]
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
include:
|
||||
- gradle: 5.6.4
|
||||
build-root-suffix: -gradle-5
|
||||
- gradle: 4.10.3
|
||||
build-root-suffix: -gradle-4
|
||||
- gradle: 3.5.1
|
||||
build-root-suffix: -gradle-4
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 8
|
||||
- name: Run Gradle build
|
||||
uses: ./
|
||||
id: gradle
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{matrix.gradle}}
|
||||
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
arguments: help -DgradleVersionCheck=${{matrix.gradle}}
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
|
185
.github/workflows/integ-test-inject-develocity.yml
vendored
185
.github/workflows/integ-test-inject-develocity.yml
vendored
@ -1,185 +0,0 @@
|
||||
name: Test develocity injection
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
DEVELOCITY_ACCESS_KEY:
|
||||
required: true
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: inject-develocity-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
inject-develocity:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gradle: ['current', '7.6.2', '6.9.4', '5.6.4']
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
plugin-version: ['3.16.2', '4.0']
|
||||
include:
|
||||
- plugin-version: '3.16.2'
|
||||
accessKeyEnv: GRADLE_ENTERPRISE_ACCESS_KEY
|
||||
- plugin-version: '4.0'
|
||||
accessKeyEnv: DEVELOCITY_ACCESS_KEY
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
DEVELOCITY_INJECTION_ENABLED: true
|
||||
DEVELOCITY_INJECTION_URL: https://ge.solutions-team.gradle.com
|
||||
DEVELOCITY_INJECTION_DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
|
||||
DEVELOCITY_INJECTION_CCUD_PLUGIN_VERSION: '2.2.1'
|
||||
${{matrix.accessKeyEnv}}: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
||||
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-ge
|
||||
run: gradle help
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
- name: Check short lived token (DEVELOCITY_ACCESS_KEY)
|
||||
run: "[ ${#DEVELOCITY_ACCESS_KEY} -gt 500 ] || (echo 'DEVELOCITY_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
||||
- name: Check short lived token (GRADLE_ENTERPRISE_ACCESS_KEY)
|
||||
run: "[ ${#GRADLE_ENTERPRISE_ACCESS_KEY} -gt 500 ] || (echo 'GRADLE_ENTERPRISE_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
||||
|
||||
inject-develocity-with-access-key:
|
||||
env:
|
||||
DEVELOCITY_INJECTION_ENABLED: true
|
||||
DEVELOCITY_INJECTION_URL: 'https://ge.solutions-team.gradle.com'
|
||||
DEVELOCITY_INJECTION_DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
|
||||
DEVELOCITY_INJECTION_CCUD_PLUGIN_VERSION: '2.2.1'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gradle: ['current', '7.6.2', '6.9.4', '5.6.4']
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
plugin-version: ['3.16.2', '4.0']
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
||||
develocity-token-expiry: 1
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-ge
|
||||
run: gradle help
|
||||
- name: Check short lived token (DEVELOCITY_ACCESS_KEY)
|
||||
run: "[ ${#DEVELOCITY_ACCESS_KEY} -gt 500 ] || (echo 'DEVELOCITY_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
||||
- name: Check short lived token (GRADLE_ENTERPRISE_ACCESS_KEY)
|
||||
run: "[ ${#GRADLE_ENTERPRISE_ACCESS_KEY} -gt 500 ] || (echo 'GRADLE_ENTERPRISE_ACCESS_KEY does not look like a short lived token'; exit 1)"
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
inject-develocity-short-lived-token-failed:
|
||||
env:
|
||||
DEVELOCITY_INJECTION_ENABLED: true
|
||||
DEVELOCITY_INJECTION_URL: 'https://localhost:3333/'
|
||||
DEVELOCITY_INJECTION_DEVELOCITY_PLUGIN_VERSION: ${{ matrix.plugin-version }}
|
||||
DEVELOCITY_INJECTION_CCUD_PLUGIN_VERSION: '2.1'
|
||||
# Access key also set as an env var, we want to check it does not leak
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
||||
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gradle: ['current', '7.6.2', '6.9.4', '5.6.4']
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
plugin-version: [ '3.16.2', '4.0' ]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-ge
|
||||
run: gradle help
|
||||
- name: Check access key is not blank (DEVELOCITY_ACCESS_KEY)
|
||||
run: "[ \"${DEVELOCITY_ACCESS_KEY}\" != \"\" ] || (echo 'using DEVELOCITY_ACCESS_KEY!'; exit 1)"
|
||||
- name: Check access key is not blank (GRADLE_ENTERPRISE_ACCESS_KEY)
|
||||
run: "[ \"${GRADLE_ENTERPRISE_ACCESS_KEY}\" != \"\" ] || (echo 'GRADLE_ENTERPRISE_ACCESS_KEY is still supported in v3!'; exit 1)"
|
||||
|
||||
inject-develocity-with-access-key-from-input-actions:
|
||||
env:
|
||||
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gradle: ['current', '7.6.2', '6.9.4', '5.6.4']
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
plugin-version: [ '3.16.2', '4.0' ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
develocity-injection-enabled: true
|
||||
develocity-url: 'https://ge.solutions-team.gradle.com'
|
||||
develocity-plugin-version: ${{ matrix.plugin-version }}
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-ge
|
||||
run: gradle help
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
60
.github/workflows/integ-test-inject-gradle-enterprise.yml
vendored
Normal file
60
.github/workflows/integ-test-inject-gradle-enterprise.yml
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
name: Test gradle enterprise injection
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY:
|
||||
required: true
|
||||
|
||||
env:
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
GRADLE_ENTERPRISE_INJECTION_ENABLED: true
|
||||
GRADLE_ENTERPRISE_URL: https://ge.solutions-team.gradle.com
|
||||
GRADLE_ENTERPRISE_PLUGIN_VERSION: 3.16.1
|
||||
GRADLE_ENTERPRISE_CCUD_PLUGIN_VERSION: 1.12.1
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
inject-gradle-enterprise:
|
||||
strategy:
|
||||
matrix:
|
||||
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 8
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-ge
|
||||
run: gradle help
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
@ -5,55 +5,51 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Tests for executing with different Gradle versions.
|
||||
# Each build verifies that it is executed with the expected Gradle version.
|
||||
provision-gradle:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
include:
|
||||
- os: windows-latest
|
||||
script-suffix: '.bat'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle with v6.9
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: '6.9'
|
||||
gradle-version: 6.9
|
||||
- name: Test uses Gradle v6.9
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help "-DgradleVersionCheck=6.9"
|
||||
- name: Setup Gradle with v7.1.1
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: '7.1.1'
|
||||
gradle-version: 7.1.1
|
||||
- name: Test uses Gradle v7.1.1
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help "-DgradleVersionCheck=7.1.1"
|
||||
- name: Setup Gradle with release-candidate
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: release-candidate
|
||||
- name: Test use release-candidate
|
||||
@ -61,58 +57,48 @@ jobs:
|
||||
run: gradle help
|
||||
- name: Setup Gradle with current
|
||||
id: gradle-current
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: current
|
||||
- name: Test use current
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help
|
||||
- name: Check current version output parameter
|
||||
if: ${{ !startsWith(steps.gradle-current.outputs.gradle-version , '8.') }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.gradle-current.outputs.gradle-version }}"')
|
||||
|
||||
provision-gradle-version:
|
||||
gradle-versions:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gradle: ['8.13', '8.12', '8.12-rc-1', '8.9', '8.1', '7.6.4', '6.9.4', '5.6.4', '4.10.3', '3.5.1']
|
||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3, 3.5.1]
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
include:
|
||||
- java-version: 11
|
||||
- gradle: '5.6.4'
|
||||
- gradle: 5.6.4
|
||||
build-root-suffix: -gradle-5
|
||||
- gradle: '4.10.3'
|
||||
- gradle: 4.10.3
|
||||
build-root-suffix: -gradle-4
|
||||
- gradle: '3.5.1'
|
||||
- gradle: 3.5.1
|
||||
build-root-suffix: -gradle-4
|
||||
java-version: 8
|
||||
exclude:
|
||||
- os: macos-latest # Java 8 is not supported on macos-latest, so we cannot test Gradle 3.5.1
|
||||
gradle: '3.5.1'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: ${{ matrix.java-version }}
|
||||
java-version: 8
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
- name: Check output parameter
|
||||
if: ${{ steps.setup-gradle.outputs.gradle-version != matrix.gradle }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.setup-gradle.outputs.gradle-version }}"')
|
||||
@ -122,7 +108,7 @@ jobs:
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
@ -5,231 +5,174 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
GRADLE_ENCRYPTION_KEY:
|
||||
required: true
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
restore-cc-seed-build-groovy:
|
||||
seed-build-groovy:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
cache-write-only: true # Ensure we start with a clean cache entry
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
gradle-version: release-nightly
|
||||
- name: Groovy build with configuration-cache enabled
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: gradle test --configuration-cache
|
||||
|
||||
restore-cc-verify-build-groovy:
|
||||
verify-build-groovy:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_1
|
||||
needs: restore-cc-seed-build-groovy
|
||||
needs: seed-build-groovy
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
cache-read-only: false
|
||||
cache-cleanup: on-success
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
- name: Groovy build with configuration-cache enabled
|
||||
id: execute
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: gradle test --configuration-cache
|
||||
- name: Verify configuration-cache hit
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -e ".github/workflow-samples/groovy-dsl/task-configured.txt" ]; then
|
||||
echo "Configuration cache was not used - task was configured unexpectedly"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure that cache-cleanup doesn't remove all necessary files
|
||||
restore-cc-verify-no-cache-cleanup-groovy:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_2
|
||||
needs: restore-cc-verify-build-groovy
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
gradle-version: release-nightly
|
||||
- name: Groovy build with configuration-cache enabled
|
||||
id: execute
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: gradle test --configuration-cache
|
||||
- name: Verify configuration-cache hit
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -e ".github/workflow-samples/groovy-dsl/task-configured.txt" ]; then
|
||||
echo "Configuration cache was not used - task was configured unexpectedly"
|
||||
exit 1
|
||||
fi
|
||||
- name: Check that configuration-cache was used
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs')
|
||||
if (fs.existsSync('.github/workflow-samples/groovy-dsl/task-configured.txt')) {
|
||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||
}
|
||||
|
||||
# Check that the build can run when no extracted cache entries are restored
|
||||
restore-cc-gradle-user-home-not-fully-restored:
|
||||
gradle-user-home-not-fully-restored:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_x
|
||||
needs: restore-cc-seed-build-groovy
|
||||
needs: seed-build-groovy
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle with no extracted cache entries restored
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
||||
with:
|
||||
cache-read-only: true
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
gradle-version: release-nightly
|
||||
- name: Check execute Gradle build with configuration cache enabled (but not restored)
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
run: gradle test --configuration-cache
|
||||
|
||||
restore-cc-seed-build-kotlin:
|
||||
seed-build-kotlin:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
cache-write-only: true # Ensure we start with a clean cache entry
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
gradle-version: release-nightly
|
||||
- name: Execute 'help' with configuration-cache enabled
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: gradle help --configuration-cache
|
||||
|
||||
restore-cc-modify-build-kotlin:
|
||||
modify-build-kotlin:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_1
|
||||
needs: restore-cc-seed-build-kotlin
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin-modified
|
||||
needs: seed-build-kotlin
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
gradle-version: release-nightly
|
||||
- name: Execute 'test' with configuration-cache enabled
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: gradle test --configuration-cache
|
||||
|
||||
# Test restore configuration-cache from the third build invocation
|
||||
restore-cc-verify-build-kotlin:
|
||||
verify-build-kotlin:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_2
|
||||
needs: restore-cc-modify-build-kotlin
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin-modified
|
||||
needs: modify-build-kotlin
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
gradle-version: release-nightly
|
||||
- name: Execute 'test' again with configuration-cache enabled
|
||||
id: execute
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: gradle test --configuration-cache
|
||||
- name: Verify configuration-cache hit
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -e ".github/workflow-samples/kotlin-dsl/task-configured.txt" ]; then
|
||||
echo "Configuration cache was not used - task was configured unexpectedly"
|
||||
exit 1
|
||||
fi
|
||||
- name: Check that configuration-cache was used
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs')
|
||||
if (fs.existsSync('.github/workflow-samples/kotlin-dsl/task-configured.txt')) {
|
||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||
}
|
||||
|
||||
|
@ -5,30 +5,31 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
skip-dist:
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-containerized-gradle-home-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
restore-containerized-seed-build:
|
||||
seed-build:
|
||||
runs-on: ubuntu-latest
|
||||
container: fedora:latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: temurin
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build using Gradle wrapper
|
||||
@ -36,18 +37,22 @@ jobs:
|
||||
run: ./gradlew test
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
restore-containerized-dependencies-cache:
|
||||
needs: restore-containerized-seed-build
|
||||
dependencies-cache:
|
||||
needs: seed-build
|
||||
runs-on: ubuntu-latest
|
||||
container: fedora:latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: temurin
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
|
@ -5,33 +5,29 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
skip-dist:
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
restore-custom-gradle-home-seed-build:
|
||||
seed-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Set Gradle User Home
|
||||
run: |
|
||||
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build using Gradle wrapper
|
||||
@ -39,21 +35,20 @@ jobs:
|
||||
run: ./gradlew test --info
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
restore-custom-gradle-home-dependencies-cache:
|
||||
needs: restore-custom-gradle-home-seed-build
|
||||
dependencies-cache:
|
||||
needs: seed-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Set Gradle User Home
|
||||
run: |
|
||||
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
@ -61,21 +56,20 @@ jobs:
|
||||
run: ./gradlew test --offline --info
|
||||
|
||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||
restore-custom-gradle-home-build-cache:
|
||||
needs: restore-custom-gradle-home-seed-build
|
||||
build-cache:
|
||||
needs: seed-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Set Gradle User Home
|
||||
run: |
|
||||
mkdir -p $GITHUB_WORKSPACE/gradle-user-home
|
||||
echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/gradle-user-home" >> $GITHUB_ENV
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build and verify tasks from cache
|
||||
|
@ -5,38 +5,32 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-gradle-home-${{ inputs.cache-key-prefix }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
restore-gradle-home-seed-build:
|
||||
seed-build:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build using Gradle wrapper
|
||||
@ -44,22 +38,19 @@ jobs:
|
||||
run: ./gradlew test
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
restore-gradle-home-dependencies-cache:
|
||||
needs: restore-gradle-home-seed-build
|
||||
dependencies-cache:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
@ -67,22 +58,19 @@ jobs:
|
||||
run: ./gradlew test --offline
|
||||
|
||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||
restore-gradle-home-build-cache:
|
||||
needs: restore-gradle-home-seed-build
|
||||
build-cache:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build and verify tasks from cache
|
||||
@ -90,22 +78,19 @@ jobs:
|
||||
run: ./gradlew test -DverifyCachedBuild=true
|
||||
|
||||
# Check that the build can run when Gradle User Home is not fully restored
|
||||
restore-gradle-home-no-extracted-cache-entries-restored:
|
||||
needs: restore-gradle-home-seed-build
|
||||
no-extracted-cache-entries-restored:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle with no extracted cache entries restored
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_SKIP_RESTORE: "generated-gradle-jars|wrapper-zips|java-toolchains|instrumented-jars|dependencies|kotlin-dsl"
|
||||
with:
|
||||
@ -115,20 +100,17 @@ jobs:
|
||||
run: ./gradlew test
|
||||
|
||||
# Test that a pre-existing gradle-user-home can be overwritten by the restored cache
|
||||
restore-gradle-home-pre-existing-gradle-home:
|
||||
needs: restore-gradle-home-seed-build
|
||||
pre-existing-gradle-home:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Pre-create Gradle User Home
|
||||
shell: bash
|
||||
run: |
|
||||
@ -136,7 +118,7 @@ jobs:
|
||||
touch ~/.gradle/gradle.properties
|
||||
touch ~/.gradle/caches/dummy.txt
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
cache-overwrite-existing: true
|
||||
|
@ -5,37 +5,31 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
restore-java-toolchain-seed-build:
|
||||
seed-build:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build using Gradle wrapper
|
||||
@ -43,22 +37,19 @@ jobs:
|
||||
run: ./gradlew test --info
|
||||
|
||||
# Test that the gradle-user-home cache will cache the toolchain, by running build with --offline
|
||||
restore-java-toolchain-verify-build:
|
||||
needs: restore-java-toolchain-seed-build
|
||||
toolchain-cache:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
|
@ -5,59 +5,50 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
sample-gradle-plugin-seed-build:
|
||||
seed-build:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build gradle-plugin project
|
||||
working-directory: .github/workflow-samples/gradle-plugin
|
||||
run: ./gradlew build
|
||||
|
||||
sample-gradle-plugin-verify-build:
|
||||
needs: sample-gradle-plugin-seed-build
|
||||
verify-build:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Build gradle-plugin project
|
||||
|
@ -5,59 +5,50 @@ on:
|
||||
inputs:
|
||||
cache-key-prefix:
|
||||
type: string
|
||||
default: '0'
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||
download-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
|
||||
jobs:
|
||||
sample-kotlin-dsl-seed-build:
|
||||
seed-build:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew build
|
||||
|
||||
sample-kotlin-dsl-verify-build:
|
||||
needs: sample-kotlin-dsl-seed-build
|
||||
verify-build:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
uses: actions/checkout@v4
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle
|
||||
uses: ./setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Build kotlin-dsl project
|
||||
|
168
.github/workflows/integ-test-wrapper-validation.yml
vendored
168
.github/workflows/integ-test-wrapper-validation.yml
vendored
@ -1,168 +0,0 @@
|
||||
name: Test wrapper validation
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
SKIP_DIST: ${{ inputs.skip-dist }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
wrapper-validation-setup-gradle:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Run wrapper-validation-action
|
||||
id: setup-gradle
|
||||
uses: ./setup-gradle
|
||||
env:
|
||||
ALLOWED_GRADLE_WRAPPER_CHECKSUMS: ''
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check failure
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ steps.setup-gradle.outcome}}" != "failure" ] ; then
|
||||
echo "Expected validation to fail, but it didn't"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wrapper-validation-success:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Run wrapper-validation-action
|
||||
id: action-test
|
||||
uses: ./wrapper-validation
|
||||
with:
|
||||
# to allow the invalid wrapper jar present in test data
|
||||
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
||||
min-wrapper-count: 10
|
||||
|
||||
- name: Check outcome
|
||||
env:
|
||||
# Evaluate workflow expressions here as env variable values instead of inside shell script
|
||||
# below to not accidentally inject code into shell script or break its syntax
|
||||
FAILED_WRAPPERS: ${{ steps.action-test.outputs.failed-wrapper }}
|
||||
FAILED_WRAPPERS_MATCHES: ${{ steps.action-test.outputs.failed-wrapper == '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$FAILED_WRAPPERS_MATCHES" != "true" ] ; then
|
||||
echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wrapper-validation-error:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Run wrapper-validation-action
|
||||
id: action-test
|
||||
uses: ./wrapper-validation
|
||||
# Expected to fail; validated below
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check outcome
|
||||
env:
|
||||
# Evaluate workflow expressions here as env variable values instead of inside shell script
|
||||
# below to not accidentally inject code into shell script or break its syntax
|
||||
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
|
||||
FAILED_WRAPPERS: ${{ steps.action-test.outputs.failed-wrapper }}
|
||||
FAILED_WRAPPERS_MATCHES: ${{ steps.action-test.outputs.failed-wrapper == 'sources/test/jest/wrapper-validation/data/invalid/gradle-wrapper.jar|sources/test/jest/wrapper-validation/data/invalid/gradlе-wrapper.jar' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$VALIDATION_FAILED" != "true" ] ; then
|
||||
echo "Expected validation to fail, but it didn't"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$FAILED_WRAPPERS_MATCHES" != "true" ] ; then
|
||||
echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wrapper-validation-minimum-wrapper-count:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Run wrapper-validation-action
|
||||
id: action-test
|
||||
uses: ./wrapper-validation
|
||||
with:
|
||||
# to allow the invalid wrapper jar present in test data
|
||||
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
||||
min-wrapper-count: 11
|
||||
# Expected to fail; validated below
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check outcome
|
||||
env:
|
||||
# Evaluate workflow expressions here as env variable values instead of inside shell script
|
||||
# below to not accidentally inject code into shell script or break its syntax
|
||||
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$VALIDATION_FAILED" != "true" ] ; then
|
||||
echo "Expected validation to fail, but it didn't"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wrapper-validation-zero-wrappers:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 # Checkout the repository with no wrappers
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.github/actions
|
||||
dist
|
||||
wrapper-validation
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
|
||||
- name: Run wrapper-validation-action
|
||||
id: action-test
|
||||
uses: ./wrapper-validation
|
||||
# Expected to fail; validated below
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check outcome
|
||||
env:
|
||||
# Evaluate workflow expressions here as env variable values instead of inside shell script
|
||||
# below to not accidentally inject code into shell script or break its syntax
|
||||
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$VALIDATION_FAILED" != "true" ] ; then
|
||||
echo "Expected validation to fail, but it didn't"
|
||||
exit 1
|
||||
fi
|
28
.github/workflows/purge-old-workflow-runs.yml
vendored
Normal file
28
.github/workflows/purge-old-workflow-runs.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: Purge old workflow runs
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
days:
|
||||
description: 'Purge runs older than days'
|
||||
required: true
|
||||
default: 30
|
||||
minimum_runs:
|
||||
description: 'The minimum runs to keep for each workflow.'
|
||||
required: true
|
||||
default: 6
|
||||
delete_workflow_pattern:
|
||||
description: 'The name of the workflow. if not set then it will target all workflows.'
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
del_runs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Purge workflow runs
|
||||
uses: Mattraks/delete-workflow-runs@v2
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
repository: ${{ github.repository }}
|
||||
retain_days: ${{ github.event.inputs.days }}
|
||||
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
|
||||
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
|
55
.github/workflows/suite-integ-test-caching.yml
vendored
55
.github/workflows/suite-integ-test-caching.yml
vendored
@ -1,55 +0,0 @@
|
||||
name: suite-integ-test-caching
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
cache-cleanup:
|
||||
uses: ./.github/workflows/integ-test-cache-cleanup.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
caching-config:
|
||||
uses: ./.github/workflows/integ-test-caching-config.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
restore-configuration-cache:
|
||||
if: ${{ ! github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
secrets:
|
||||
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
|
||||
restore-containerized-gradle-home:
|
||||
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
restore-custom-gradle-home:
|
||||
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
restore-gradle-home:
|
||||
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
restore-java-toolchain:
|
||||
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
85
.github/workflows/suite-integ-test-other.yml
vendored
85
.github/workflows/suite-integ-test-other.yml
vendored
@ -1,85 +0,0 @@
|
||||
name: suite-integ-test-other
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runner-os:
|
||||
type: string
|
||||
default: '["ubuntu-latest"]'
|
||||
skip-dist:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-scan-publish:
|
||||
uses: ./.github/workflows/integ-test-build-scan-publish.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
dependency-graph:
|
||||
if: ${{ ! github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/workflows/integ-test-dependency-graph.yml
|
||||
permissions:
|
||||
contents: write
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
dependency-submission:
|
||||
if: ${{ ! github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/workflows/integ-test-dependency-submission.yml
|
||||
permissions:
|
||||
contents: write
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
dependency-submission-failures:
|
||||
if: ${{ ! github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/workflows/integ-test-dependency-submission-failures.yml
|
||||
permissions:
|
||||
contents: write
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
develocity-injection:
|
||||
if: ${{ ! github.event.pull_request.head.repo.fork }}
|
||||
uses: ./.github/workflows/integ-test-inject-develocity.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
secrets:
|
||||
DEVELOCITY_ACCESS_KEY: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}
|
||||
|
||||
provision-gradle-versions:
|
||||
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
sample-kotlin-dsl:
|
||||
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
sample-gradle-plugin:
|
||||
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
toolchain-detection:
|
||||
uses: ./.github/workflows/integ-test-detect-toolchains.yml
|
||||
with:
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
||||
|
||||
wrapper-validation:
|
||||
uses: ./.github/workflows/integ-test-wrapper-validation.yml
|
||||
with:
|
||||
runner-os: '${{ inputs.runner-os }}'
|
||||
skip-dist: ${{ inputs.skip-dist }}
|
94
.github/workflows/update-checksums-file.js
vendored
94
.github/workflows/update-checksums-file.js
vendored
@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Updates the `wrapper-checksums.json` file
|
||||
*
|
||||
* This is intended to be executed by the GitHub workflow, but can also be run
|
||||
* manually.
|
||||
*/
|
||||
|
||||
// @ts-check
|
||||
|
||||
const httpm = require('../../sources/node_modules/typed-rest-client/HttpClient')
|
||||
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
/**
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function main() {
|
||||
const httpc = new httpm.HttpClient(
|
||||
'gradle/wrapper-validation-action/update-checksums-workflow',
|
||||
undefined,
|
||||
{allowRetries: true, maxRetries: 3}
|
||||
)
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async function httpGetText(url) {
|
||||
const response = await httpc.get(url)
|
||||
return await response.readBody()
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} ApiVersionEntry
|
||||
* @property {string} version - version name
|
||||
* @property {string=} wrapperChecksumUrl - wrapper checksum URL; not present for old versions
|
||||
* @property {boolean} snapshot - whether this is a snapshot version
|
||||
*/
|
||||
|
||||
/**
|
||||
* @returns {Promise<ApiVersionEntry[]>}
|
||||
*/
|
||||
async function httpGetVersions() {
|
||||
return JSON.parse(
|
||||
await httpGetText('https://services.gradle.org/versions/all')
|
||||
)
|
||||
}
|
||||
|
||||
const versions = (await httpGetVersions())
|
||||
// Only include versions with checksum
|
||||
.filter(e => e.wrapperChecksumUrl !== undefined)
|
||||
// Ignore snapshots; they are changing frequently so no point in including them in checksums file
|
||||
.filter(e => !e.snapshot)
|
||||
console.info(`Got ${versions.length} relevant Gradle versions`)
|
||||
|
||||
// Note: For simplicity don't sort the entries but keep the order from the API; this also has the
|
||||
// advantage that the latest versions come first, so compared to appending versions at the end
|
||||
// this will not cause redundant Git diff due to trailing `,` being forbidden by JSON
|
||||
|
||||
/**
|
||||
* @typedef {Object} FileVersionEntry
|
||||
* @property {string} version
|
||||
* @property {string} checksum
|
||||
*/
|
||||
/** @type {FileVersionEntry[]} */
|
||||
const fileVersions = []
|
||||
for (const entry of versions) {
|
||||
/** @type {string} */
|
||||
// @ts-ignore
|
||||
const checksumUrl = entry.wrapperChecksumUrl
|
||||
const checksum = await httpGetText(checksumUrl)
|
||||
fileVersions.push({version: entry.version, checksum})
|
||||
}
|
||||
|
||||
const jsonPath = path.resolve(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'sources',
|
||||
'src',
|
||||
'wrapper-validation',
|
||||
'wrapper-checksums.json'
|
||||
)
|
||||
console.info(`Writing checksums file to ${jsonPath}`)
|
||||
// Write pretty-printed JSON (and add trailing line break)
|
||||
fs.writeFileSync(jsonPath, JSON.stringify(fileVersions, null, 2) + '\n')
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e)
|
||||
// Manually set error exit code, otherwise error is logged but script exits successfully
|
||||
process.exitCode = 1
|
||||
})
|
68
.github/workflows/update-checksums-file.yml
vendored
68
.github/workflows/update-checksums-file.yml
vendored
@ -1,68 +0,0 @@
|
||||
name: 'Update Wrapper checksums file'
|
||||
|
||||
on:
|
||||
# Run weekly (at arbitrary time)
|
||||
schedule:
|
||||
- cron: '24 5 * * 6'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-checksums:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
name: Update checksums
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm clean-install typed-rest-client@1.8.11 --no-save
|
||||
working-directory: sources
|
||||
|
||||
- name: Update checksums file
|
||||
run: node ../.github/workflows/update-checksums-file.js
|
||||
working-directory: sources
|
||||
|
||||
- name: Import GPG key to sign commits
|
||||
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GH_BOT_PGP_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GH_BOT_PGP_PASSPHRASE }}
|
||||
git_user_signingkey: true
|
||||
git_commit_gpgsign: true
|
||||
git_config_global: true
|
||||
|
||||
# If there are no changes, this action will not create a pull request
|
||||
- name: Create or update pull request
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
||||
with:
|
||||
branch: bot/wrapper-checksums-update
|
||||
author: bot-githubaction <bot-githubaction@gradle.com>
|
||||
committer: bot-githubaction <bot-githubaction@gradle.com>
|
||||
commit-message: Update known wrapper checksums
|
||||
title: Update known wrapper checksums
|
||||
# Note: Unfortunately this action cannot trigger the regular workflows for the PR automatically, see
|
||||
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
|
||||
# Therefore suggest below to close and then reopen the PR
|
||||
body: |
|
||||
Automatically generated pull request to update the known wrapper checksums.
|
||||
|
||||
In case of conflicts, manually run the workflow from the [Actions tab](https://github.com/gradle/actions/actions/workflows/update-checksums-file.yml), the changes will then be force-pushed onto this pull request branch.
|
||||
Do not manually update the pull request branch; those changes might get overwritten.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> GitHub workflows have not been executed for this pull request yet. Before merging, close and then directly reopen this pull request to trigger the workflows.
|
106
.gitignore
vendored
106
.gitignore
vendored
@ -1,2 +1,104 @@
|
||||
.git
|
||||
.vscode
|
||||
# Dependency directory
|
||||
node_modules
|
||||
|
||||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# OS metadata
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Ignore built ts files
|
||||
__tests__/runner/*
|
||||
# lib/**/*
|
||||
|
||||
# IntelliJ IDEA config files
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
|
3
.prettierignore
Normal file
3
.prettierignore
Normal file
@ -0,0 +1,3 @@
|
||||
dist/
|
||||
lib/
|
||||
node_modules/
|
@ -1,3 +1,3 @@
|
||||
# Configuration file for asdf version manager
|
||||
nodejs 20.19.0
|
||||
gradle 8.13
|
||||
nodejs 20.10.0
|
||||
gradle 8.5
|
@ -1,34 +1,14 @@
|
||||
## Building
|
||||
### How to merge a Dependabot PR
|
||||
|
||||
The `build` script in the project root provides a convenient way to perform many local build tasks:
|
||||
1. `./build` will lint and compile typescript sources
|
||||
2. `./build all` will lint and compile typescript and run unit tests
|
||||
3. `./build install` will install npm packages followed by lint and compile
|
||||
4. `./build init-scripts` will run the init-script integration tests
|
||||
5. `./build act <act-commands>` will run `act` after building local changes (see below)
|
||||
The "distribution" for a GitHub Action is checked into the repository itself.
|
||||
In the case of the `gradle-build-action`, the transpiled sources are committed to the `dist` directory.
|
||||
Any production dependencies are inlined into the distribution.
|
||||
So if a Dependabot PR updates a production dependency (or a dev dependency that changes the distribution, like the Typescript compiler),
|
||||
then a manual step is required to rebuild the dist and commit.
|
||||
|
||||
## Using `act` to run integ-test workflows locally
|
||||
|
||||
It's possible to run GitHub Actions workflows locally with https://nektosact.com/.
|
||||
Many of the test workflows from this repository can be run in this way, making it easier to
|
||||
test local changes without pushing to a branch.
|
||||
|
||||
This feature is most useful to run a single `integ-test-*` workflow. Avoid running `ci-quick-test` or other aggregating workflows unless you want to use your local machine as a heater!
|
||||
|
||||
Example running a single workflow:
|
||||
`./build act -W .github/workflows/integ-test-caching-config.yml`
|
||||
|
||||
Example running a single job:
|
||||
`./build act -W .github/workflows/integ-test-caching-config.yml -j cache-disabled-pre-existing-gradle-home`
|
||||
|
||||
Known issues:
|
||||
- `integ-test-detect-java-toolchains.yml` fails when running on a `linux/amd64` container, since the expected pre-installed JDKs are not present. Should be fixed by #89.
|
||||
- `act` is not yet compatible with `actions/upload-artifact@v4` (or related toolkit functions)
|
||||
- See https://github.com/nektos/act/pull/2224
|
||||
- Workflows run by `act` cannot submit to the dependency-submission API, as no `GITHUB_TOKEN` is available by default.
|
||||
|
||||
Tips:
|
||||
- Add the following lines to `~/.actrc`:
|
||||
- `--container-daemon-socket -` : Prevents "error while creating mount source path", and yes that's a solitary dash at the end
|
||||
- `--matrix os:ubuntu-latest` : Avoids a lot of logging about unsupported runners being skipped
|
||||
- Runners don't have `java` installed by default, so all workflows that run Gradle require a `setup-java` step.
|
||||
The simplest process to follow is:
|
||||
1. Checkout the dependabot branch locally eg: `git checkout dependabot/npm_and_yarn/actions/github-5.1.0`
|
||||
2. Run `npm install` to download and the new dependencies and install locally
|
||||
3. Run `npm run build` to regenerate the distribution
|
||||
4. Push the changes to the dependabot branch
|
||||
5. If/when the checks pass, you can merge the dependabot PR
|
||||
|
853
README.md
853
README.md
@ -1,105 +1,840 @@
|
||||
# GitHub Actions for Gradle builds
|
||||
# Execute Gradle builds in GitHub Actions workflows
|
||||
|
||||
[](https://scorecard.dev/viewer/?uri=github.com/gradle/actions)
|
||||
This GitHub Action can be used to configure Gradle and optionally execute a Gradle build on any platform supported by GitHub Actions.
|
||||
|
||||
This repository contains a set of GitHub Actions that are useful for building Gradle projects on GitHub.
|
||||
## Why use the `gradle-build-action`?
|
||||
|
||||
## The `setup-gradle` action
|
||||
It is possible to directly invoke Gradle in your workflow, and the `actions/setup-java@v3` action provides a simple way to cache Gradle dependencies.
|
||||
|
||||
The `setup-gradle` action can be used to configure Gradle for optimal execution on any platform supported by GitHub Actions.
|
||||
However, the `gradle-build-action` offers a number of advantages over this approach:
|
||||
|
||||
This replaces the previous `gradle/gradle-build-action`, which now delegates to this implementation.
|
||||
- Easily [configure your workflow to use a specific version of Gradle](#choose-a-specific-gradle-version) using the `gradle-version` parameter. Gradle distributions are automatically downloaded and cached.
|
||||
- More sophisticated and more efficient caching of Gradle User Home between invocations, compared to `setup-java` and most custom configurations using `actions/cache`. [More details below](#caching-build-state-between-jobs).
|
||||
- Detailed reporting of cache usage and cache configuration options allow you to [optimize the use of the GitHub actions cache](#optimizing-cache-effectiveness).
|
||||
- [Generate and Submit a GitHub Dependency Graph](#github-dependency-graph-support) for your project, enabling Dependabot security alerts.
|
||||
- [Automatic capture of Build Scan® links](#build-reporting) from the build, making these easier to locate for workflow run.
|
||||
|
||||
The recommended way to execute any Gradle build is with the help of the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), and the examples assume that the Gradle Wrapper has been configured for the project. See [this example](docs/setup-gradle.md#build-with-a-specific-gradle-version) if your project doesn't use the Gradle Wrapper.
|
||||
The `gradle-build-action` is designed to provide these benefits with minimal configuration.
|
||||
These features work both when Gradle is executed via the `gradle-build-action` and for any Gradle execution in subsequent steps.
|
||||
|
||||
## Use the action to setup Gradle
|
||||
|
||||
The recommended way to use the `gradle-build-action` is in an initial "Setup Gradle" step, with subsequent steps invoking Gradle directly with a `run` step. This makes the action minimally invasive, and allows a workflow to configure and execute a Gradle execution in any way.
|
||||
|
||||
The `gradle-build-action` works by configuring environment variables and by adding a set of Gradle init-scripts to the Gradle User Home. These will apply to all Gradle executions on the runner, no matter how Gradle is invoked.
|
||||
This means that if you have an existing workflow that executes Gradle with a `run` step, you can add an initial "Setup Gradle" Step to benefit from caching, build-scan capture and other features of the gradle-build-action.
|
||||
|
||||
### Example usage
|
||||
|
||||
```yaml
|
||||
name: Build
|
||||
name: Run Gradle on PRs
|
||||
on: pull_request
|
||||
jobs:
|
||||
gradle:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 11
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
|
||||
- name: Execute Gradle build
|
||||
run: ./gradlew build
|
||||
```
|
||||
|
||||
## Choose a specific Gradle version
|
||||
|
||||
The `gradle-build-action` can download and install a specified Gradle version, adding this installed version to the PATH.
|
||||
Downloaded Gradle versions are stored in the GitHub Actions cache, to avoid requiring downloading again later.
|
||||
|
||||
```yaml
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
gradle-version: 6.5
|
||||
```
|
||||
|
||||
The `gradle-version` parameter can be set to any valid Gradle version.
|
||||
|
||||
Moreover, you can use the following aliases:
|
||||
|
||||
| Alias | Selects |
|
||||
| --- |---|
|
||||
| `wrapper` | The Gradle wrapper's version (default, useful for matrix builds) |
|
||||
| `current` | The current [stable release](https://gradle.org/install/) |
|
||||
| `release-candidate` | The current [release candidate](https://gradle.org/release-candidate/) if any, otherwise fallback to `current` |
|
||||
| `nightly` | The latest [nightly](https://gradle.org/nightly/), fails if none. |
|
||||
| `release-nightly` | The latest [release nightly](https://gradle.org/release-nightly/), fails if none. |
|
||||
|
||||
This can be handy to automatically verify your build works with the latest release candidate of Gradle:
|
||||
|
||||
The actual Gradle version used is available as an action output: `gradle-version`.
|
||||
|
||||
```yaml
|
||||
name: Test latest Gradle RC
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 0 * * * # daily
|
||||
jobs:
|
||||
gradle-rc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 11
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
id: setup-gradle
|
||||
with:
|
||||
gradle-version: release-candidate
|
||||
- run: gradle build --dry-run # just test build configuration
|
||||
- run: echo "The release-candidate version was ${{ steps.setup-gradle.outputs.gradle-version }}"
|
||||
```
|
||||
|
||||
## Caching build state between Jobs
|
||||
|
||||
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.
|
||||
|
||||
The state that is cached includes:
|
||||
- Any distributions downloaded to satisfy a `gradle-version` parameter ;
|
||||
- A subset of the Gradle User Home directory, including downloaded dependencies, wrapper distributions, and the local build cache ;
|
||||
|
||||
To reduce the space required for caching, this action makes a best effort to reduce duplication in cache entries.
|
||||
|
||||
State will be restored from the cache during the first `gradle-build-action` step for any workflow job, and cache entries will be written back to the cache at the end of the job, after all Gradle executions have completed.
|
||||
|
||||
### Disabling caching
|
||||
|
||||
Caching is enabled by default. You can disable caching for the action as follows:
|
||||
```yaml
|
||||
cache-disabled: true
|
||||
```
|
||||
|
||||
### Using the cache read-only
|
||||
|
||||
By default, the `gradle-build-action` will only write to the cache from Jobs on the default (`main`/`master`) branch.
|
||||
Jobs on other branches will read entries from the cache but will not write updated entries.
|
||||
See [Optimizing cache effectiveness](#optimizing-cache-effectiveness) for a more detailed explanation.
|
||||
|
||||
In some circumstances it makes sense to change this default, and to configure a workflow Job to read existing cache entries but not to write changes back.
|
||||
|
||||
You can configure read-only caching for the `gradle-build-action` as follows:
|
||||
|
||||
```yaml
|
||||
cache-read-only: true
|
||||
```
|
||||
|
||||
You can also configure read-only caching only for certain branches:
|
||||
|
||||
```yaml
|
||||
# Only write to the cache for builds on the 'main' and 'release' branches. (Default is 'main' only.)
|
||||
# Builds on other branches will only read existing entries from the cache.
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/release' }}
|
||||
```
|
||||
|
||||
### Using the cache write-only
|
||||
|
||||
In certain circumstances it may be desirable to start with a clean Gradle User Home state, but to save that state at the end of a workflow Job:
|
||||
|
||||
```yaml
|
||||
cache-write-only: true
|
||||
```
|
||||
|
||||
### Overwriting an existing Gradle User Home
|
||||
|
||||
When the action detects that the Gradle User Home caches directory already exists (`~/.gradle/caches`), then by default it will not overwrite the existing content of this directory.
|
||||
This can occur when a prior action initializes this directory, or when using a self-hosted runner that retains this directory between uses.
|
||||
|
||||
In this case the Job Summary will display a message like:
|
||||
> Caching for gradle-build-action was disabled due to pre-existing Gradle User Home
|
||||
|
||||
If you want override the default and have the `gradle-build-action` caches overwrite existing content in the Gradle User Home, you can set the `cache-overwrite-existing` parameter to 'true':
|
||||
|
||||
```yaml
|
||||
cache-overwrite-existing: true
|
||||
```
|
||||
|
||||
### Saving configuration-cache data
|
||||
|
||||
When Gradle is executed with the [configuration-cache](https://docs.gradle.org/current/userguide/configuration_cache.html) enabled, the configuration-cache data is stored
|
||||
in the project directory, at `<project-dir>/.gradle/configuration-cache`. Due to the way the configuration-cache works, [this file may contain stored credentials and other
|
||||
secrets](https://docs.gradle.org/release-nightly/userguide/configuration_cache.html#config_cache:secrets), and this data needs to be encrypted in order to be safely stored in the GitHub Actions cache.
|
||||
|
||||
In order to benefit from configuration caching in your GitHub Actions workflow, you must:
|
||||
- Enable the configuration cache for your build
|
||||
- Execute your build with Gradle 8.6 or newer. This can be achieved directly, or via the Gradle Wrapper.
|
||||
- Provide a [valid Gradle encryption key](https://docs.gradle.org/release-nightly/userguide/configuration_cache.html#config_cache:secrets:configuring_encryption_key) via the `cache-encryption-key` action parameter
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
gradle-with-configuration-cache:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/gradle-build-action@v3
|
||||
with:
|
||||
gradle-version: 8.6
|
||||
cache-encryption-key: Da25KUVSE5jbGds2zXmfXw==
|
||||
- run: gradle build --configuration-cache
|
||||
```
|
||||
|
||||
### Incompatibility with other caching mechanisms
|
||||
|
||||
When using `gradle-build-action` we recommend that you avoid using other mechanisms to save and restore the Gradle User Home.
|
||||
|
||||
Specifically:
|
||||
- Avoid using `actions/cache` configured to cache the Gradle User Home, [as described in this example](https://github.com/actions/cache/blob/main/examples.md#java---gradle).
|
||||
- Avoid using `actions/setup-java` with the `cache: gradle` option, [as described here](https://github.com/actions/setup-java#caching-gradle-dependencies).
|
||||
|
||||
Using either of these mechanisms may interfere with the caching provided by this action. If you choose to use a different mechanism to save and restore the Gradle User Home, you should disable the caching provided by this action, as described above.
|
||||
|
||||
### Cache debugging and analysis
|
||||
|
||||
A report of all cache entries restored and saved is printed to the Job Summary when saving the cache entries.
|
||||
This report can provide valuable insight into how much cache space is being used.
|
||||
|
||||
It is possible to enable additional debug logging for cache operations. You do via the `GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED` environment variable:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||
```
|
||||
|
||||
Note that this setting will also prevent certain cache operations from running in parallel, further assisting with debugging.
|
||||
|
||||
## How Gradle User Home caching works
|
||||
|
||||
### Properties of the GitHub Actions cache
|
||||
|
||||
The GitHub Actions cache has some properties that present problems for efficient caching of the Gradle User Home.
|
||||
- Immutable entries: once a cache entry is written for a key, it cannot be overwritten or changed.
|
||||
- Branch scope: cache entries written for a Git branch are not visible from actions running against different branches. Entries written for the default branch are visible to all. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
|
||||
- Restore keys: if no exact match is found, a set of partial keys can be provided that will match by cache key prefix. https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
|
||||
|
||||
Each of these properties has influenced the design and implementation of the caching in `gradle-build-action`, as described below.
|
||||
|
||||
### Which content is cached
|
||||
|
||||
Using experiments and observations, we have attempted to identify which Gradle User Home content is worth saving and restoring between build invocations. We considered both the respective size of the content and the impact this content has on build times. As well as the obvious candidates like downloaded dependencies, we saw that compiled build scripts, transformed Jar files and other content can also have a significant impact.
|
||||
|
||||
In the end, we opted to save and restore as much content as is practical, including:
|
||||
- `caches/<version>/generated-gradle-jars`: These files are generated on first use of a particular Gradle version, and are expensive to recreate
|
||||
- `caches/<version>/kotlin-dsl` and `caches/<version>/scripts`: These are the compiled build scripts. The Kotlin ones in particular can benefit from caching.
|
||||
- `caches/modules-2`: The downloaded dependencies
|
||||
- `caches/transforms-3`: The results of artifact transforms
|
||||
- `caches/jars-9`: Jar files that have been processed/instrumented by Gradle
|
||||
- `caches/build-cache-1`: The local build cache
|
||||
|
||||
In certain cases a particular section of Gradle User Home will be too large to make caching effective. In these cases, particular subdirectories can be excluded from caching. See [Exclude content from Gradle User Home cache](#exclude-content-from-gradle-user-home-cache).
|
||||
|
||||
### Cache keys
|
||||
|
||||
The actual content of the Gradle User Home after a build is the result of many factors, including:
|
||||
- Core Gradle build files (`settings.gradle[.kts]`, `build.gradle[.kts]`, `gradle.properties`)
|
||||
- Associated Gradle configuration files (`gradle-wrapper.properties`, `dependencies.toml`, etc)
|
||||
- The entire content of `buildSrc` or any included builds that provide plugins.
|
||||
- The entire content of the repository, in the case of the local build cache.
|
||||
- The actual build command that was invoked, including system properties and environment variables.
|
||||
|
||||
For this reason, it's very difficult to create a cache key that will deterministically map to a saved Gradle User Home state. So instead of trying to reliably hash all of these inputs to generate a cache key, the Gradle User Home cache key is based on the currently executing Job and the current commit hash for the repository.
|
||||
|
||||
The Gradle User Home cache key is composed of:
|
||||
- The current operating system (`RUNNER_OS`)
|
||||
- The workflow name and Job ID
|
||||
- A hash of the Job matrix parameters
|
||||
- The git SHA for the latest commit
|
||||
|
||||
Specifically, the cache key is: `${cache-protocol}-gradle|${runner-os}|${workflow-name}-${job-id}[${hash-of-job-matrix}]-${git-sha}`
|
||||
|
||||
As such, the cache key is likely to change on each subsequent run of GitHub actions.
|
||||
This allows the most recent state to always be available in the GitHub actions cache.
|
||||
|
||||
### Finding a matching cache entry
|
||||
|
||||
In most cases, no exact match will exist for the cache key. Instead, the Gradle User Home will be restored for the closest matching cache entry, using a set of "restore keys". The entries will be matched with the following precedence:
|
||||
- An exact match on OS, workflow, job, matrix and Git SHA
|
||||
- The most recent entry saved for the same OS, workflow, job and matrix values
|
||||
- The most recent entry saved for the same OS, workflow and job
|
||||
- The most recent entry saved for the same OS
|
||||
|
||||
Due to branch scoping of cache entries, the above match will be first performed for entries from the same branch, and then for the default ('main') branch.
|
||||
|
||||
After the Job is complete, the current Gradle User Home state will be collected and written as a new cache entry with the complete cache key. Old entries will be expunged from the GitHub Actions cache on a least-recently-used basis.
|
||||
|
||||
Note that while effective, this mechanism is not inherently efficient. It requires the entire Gradle User Home directory to be stored separately for each branch, for every OS+Job+Matrix combination. In addition, a new cache entry to be written on every GitHub Actions run.
|
||||
|
||||
This inefficiency is effectively mitigated by [Deduplication of Gradle User Home cache entries](#deduplication-of-gradle-user-home-cache-entries), and can be further optimized for a workflow using the techniques described in [Optimizing cache effectiveness](#optimizing-cache-effectiveness).
|
||||
|
||||
### Deduplication of Gradle User Home cache entries
|
||||
|
||||
To reduce duplication between cache entries, certain artifacts in Gradle User Home are extracted and cached independently based on their identity. This allows each Gradle User Home cache entry to be relatively small, sharing common elements between them without duplication.
|
||||
|
||||
Artifacts that are cached independently include:
|
||||
- Downloaded dependencies
|
||||
- Downloaded wrapper distributions
|
||||
- Generated Gradle API jars
|
||||
- Downloaded Java Toolchains
|
||||
|
||||
For example, this means that all jobs executing a particular version of the Gradle wrapper will share a single common entry for this wrapper distribution and one for each of the generated Gradle API jars.
|
||||
|
||||
### Stopping the Gradle daemon
|
||||
|
||||
By default, the action will stop all running Gradle daemons in the post-action step, prior to saving the Gradle User Home state.
|
||||
This allows for any Gradle User Home cleanup to occur, and avoid file-locking issues on Windows.
|
||||
|
||||
If caching is disabled or the cache is in read-only mode, the daemon will not be stopped and will continue running after the job is completed.
|
||||
|
||||
## Optimizing cache effectiveness
|
||||
|
||||
Cache storage space for GitHub actions is limited, and writing new cache entries can trigger the deletion of existing entries.
|
||||
Eviction of shared cache entries can reduce cache effectiveness, slowing down your `gradle-build-action` steps.
|
||||
|
||||
There are a number of actions you can take if your cache use is less effective due to entry eviction.
|
||||
|
||||
At the end of a Job, the `gradle-build-action` will write a summary of the Gradle builds executed, together with a detailed report of the cache entries that were read and written during the Job. This report can provide valuable insights that may help to determine the right way to optimize the cache usage for your workflow.
|
||||
|
||||
### Select which jobs should write to the cache
|
||||
|
||||
Consider a workflow that first runs a Job "compile-and-unit-test" to compile the code and run some basic unit tests, which is followed by a matrix of parallel "integration-test" jobs that each run a set of integration tests for the repository. Each "integration test" Job requires all of the dependencies required by "compile-and-unit-test", and possibly one or 2 additional dependencies.
|
||||
|
||||
By default, a new cache entry will be written on completion of each integration test job. If no additional dependencies were downloaded then this cache entry will share the "dependencies" entry with the "compile-and-unit-test" job, but if a single dependency was downloaded then an entire new "dependencies" entry would be written. (The `gradle-build-action` does not _yet_ support a layered cache that could do this more efficiently). If each of these "integration-test" entries with their different "dependencies" entries is too large, then it could result in other important entries being evicted from the GitHub Actions cache.
|
||||
|
||||
There are some techniques that can be used to avoid/mitigate this issue:
|
||||
- Configure the "integration-test" jobs with `cache-read-only: true`, meaning that the Job will use the entry written by the "compile-and-unit-test" job. This will avoid the overhead of cache entries for each of these jobs, at the expense of re-downloading any additional dependencies required by "integration-test".
|
||||
- Add an additional step to the "compile-and-unit-test" job which downloads all dependencies required by the integration-test jobs but does not execute the tests. This will allow the "dependencies" entry for "compile-and-unit-test" to be shared among all cache entries for "integration-test". The resulting "integration-test" entries should be much smaller, reducing the potential for eviction.
|
||||
- Combine the above 2 techniques, so that no cache entry is written by "integration-test" jobs, but all required dependencies are already present from the restored "compile-and-unit-test" entry.
|
||||
|
||||
### Select which branches should write to the cache
|
||||
|
||||
GitHub cache entries are not shared between builds on different branches.
|
||||
This means that each PR branch will have it's own Gradle User Home cache, and will not benefit from cache entries written by other PR branches.
|
||||
An exception to this is that cache entries written in parent and upstream branches are visible to child branches, and cache entries for the default (`master`/`main`) branch can be read by actions invoked for any other branch.
|
||||
|
||||
By default, the `gradle-build-action` will only _write_ to the cache for builds run on the default (`master`/`main`) branch.
|
||||
Jobs run on other branches will only read from the cache. In most cases, this is the desired behaviour,
|
||||
because Jobs run against other branches will benefit from the cache Gradle User Home from `main`,
|
||||
without writing private cache entries that could lead to evicting shared entries.
|
||||
|
||||
If you have other long-lived development branches that would benefit from writing to the cache,
|
||||
you can configure these by overriding the `cache-read-only` action parameter.
|
||||
See [Using the cache read-only](#using-the-cache-read-only) for more details.
|
||||
|
||||
Similarly, you could use `cache-read-only` for certain jobs in the workflow, and instead have these jobs reuse the cache content from upstream jobs.
|
||||
|
||||
### Exclude content from Gradle User Home cache
|
||||
|
||||
As well as any wrapper distributions, the action will attempt to save and restore the `caches` and `notifications` directories from Gradle User Home.
|
||||
|
||||
Each build is different, and some builds produce more Gradle User Home content than others.
|
||||
[Cache debugging ](#cache-debugging-and-analysis) can provide insight into which cache entries are the largest,
|
||||
and the contents to be cached can be fine tuned by including and excluding certain paths within Gradle User Home.
|
||||
|
||||
```yaml
|
||||
# Cache downloaded JDKs in addition to the default directories.
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
notifications
|
||||
jdks
|
||||
# Exclude the local build-cache and keyrings from the directories cached.
|
||||
gradle-home-cache-excludes: |
|
||||
caches/build-cache-1
|
||||
caches/keyrings
|
||||
```
|
||||
|
||||
You can specify any number of fixed paths or patterns to include or exclude.
|
||||
File pattern support is documented at https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#patterns-to-match-file-paths.
|
||||
|
||||
### Remove unused files from Gradle User Home before saving to cache
|
||||
|
||||
The Gradle User Home directory has a tendency to grow over time. When you switch to a new Gradle wrapper version or upgrade a dependency version
|
||||
the old files are not automatically and immediately removed. While this can make sense in a local environment, in a GitHub Actions environment
|
||||
it can lead to ever-larger Gradle User Home cache entries being saved and restored.
|
||||
|
||||
In order to avoid this situation, the `gradle-build-action` supports the `gradle-home-cache-cleanup` parameter.
|
||||
When enabled, this feature will attempt to delete any files in the Gradle User Home that were not used by Gradle during the GitHub Actions workflow,
|
||||
prior to saving the Gradle User Home to the GitHub Actions cache.
|
||||
|
||||
Gradle Home cache cleanup is considered experimental and is disabled by default. You can enable this feature for the action as follows:
|
||||
```yaml
|
||||
gradle-home-cache-cleanup: true
|
||||
```
|
||||
|
||||
## Build reporting
|
||||
|
||||
The `gradle-build-action` collects information about any Gradle executions that occur in a workflow, and reports these via
|
||||
a Job Summary, visible in the GitHub Actions UI. For each Gradle execution, details about the invocation are listed, together with
|
||||
a link to any Build Scan® published.
|
||||
|
||||
Generation of a Job Summary is enabled by default. If this is not desired, it can be disable as follows:
|
||||
```yaml
|
||||
generate-job-summary: false
|
||||
```
|
||||
|
||||
Note that the action collects information about Gradle invocations via an [Initialization Script](https://docs.gradle.org/current/userguide/init_scripts.html#sec:using_an_init_script)
|
||||
located at `USER_HOME/.gradle/init.d/build-result-capture.init.gradle`.
|
||||
If you are using init scripts for the [Gradle Enterprise Gradle Plugin](https://plugins.gradle.org/plugin/com.gradle.enterprise) like
|
||||
[`scans-init.gradle` or `gradle-enterprise-init.gradle`](https://docs.gradle.com/enterprise/gradle-plugin/#scans_gradle_com),
|
||||
you'll need to ensure these files are applied prior to `build-result-capture.init.gradle`.
|
||||
Since Gradle applies init scripts in alphabetical order, one way to ensure this is via file naming.
|
||||
|
||||
### Build Scan® link as Step output
|
||||
|
||||
As well as reporting the [Build Scan](https://gradle.com/build-scans/) link in the Job Summary,
|
||||
the `gradle-build-action` action makes this link available as a Step output named `build-scan-url`.
|
||||
|
||||
You can then use that link in subsequent actions of your workflow. For example:
|
||||
|
||||
```yaml
|
||||
# .github/workflows/gradle-build-pr.yml
|
||||
name: Run Gradle on PRs
|
||||
on: pull_request
|
||||
jobs:
|
||||
gradle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: Run build with Gradle wrapper
|
||||
id: gradle
|
||||
run: ./gradlew build --scan
|
||||
- name: "Add Build Scan URL as PR comment"
|
||||
uses: actions/github-script@v5
|
||||
if: github.event_name == 'pull_request' && failure()
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '❌ ${{ github.workflow }} failed: ${{ steps.gradle.outputs.build-scan-url }}'
|
||||
})
|
||||
```
|
||||
|
||||
### Saving build outputs
|
||||
|
||||
By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan links for your build,
|
||||
but any output files generated by the build will not be saved.
|
||||
|
||||
To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action.
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
gradle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: Run build with Gradle wrapper
|
||||
run: ./gradlew build --scan
|
||||
- name: Upload build reports
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: build-reports
|
||||
path: build/reports/
|
||||
```
|
||||
|
||||
## Support for GitHub Enterprise Server (GHES)
|
||||
|
||||
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:
|
||||
- Build Scan links are captured and displayed in the GitHub Actions UI
|
||||
- Easily run your build with different versions of Gradle
|
||||
- Save/restore of Gradle User Home (requires GHES v3.5+ : GitHub Actions cache was introduced in GHES 3.5)
|
||||
- Support for GitHub Actions Job Summary (requires GHES 3.6+ : GitHub Actions Job Summary support was introduced in GHES 3.6). In earlier versions of GHES the build-results summary and caching report will be written to the workflow log, as part of the post-action step.
|
||||
|
||||
# GitHub Dependency Graph support
|
||||
|
||||
The `gradle-build-action` has support for submitting a [GitHub Dependency Graph](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph) snapshot via the [GitHub Dependency Submission API](https://docs.github.com/en/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28).
|
||||
|
||||
The dependency graph snapshot is generated via integration with the [GitHub Dependency Graph Gradle Plugin](https://plugins.gradle.org/plugin/org.gradle.github-dependency-graph-gradle-plugin), and saved as a workflow artifact. The generated snapshot files can be submitted either in the same job, or in a subsequent job (in the same or a dependent workflow).
|
||||
|
||||
The generated dependency graph snapshot reports all of the dependencies that were resolved during a build execution, and is used by GitHub to generate [Dependabot Alerts](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts) for vulnerable dependencies, as well as to populate the [Dependency Graph insights view](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository#viewing-the-dependency-graph).
|
||||
|
||||
## Enable Dependency Graph generation for a workflow
|
||||
|
||||
You enable GitHub Dependency Graph support by setting the `dependency-graph` action parameter. Valid values are:
|
||||
|
||||
| Option | Behaviour |
|
||||
| --- | --- |
|
||||
| `disabled` | Do not generate a dependency graph for any build invocations.<p>This is the default. |
|
||||
| `generate` | Generate a dependency graph snapshot for each build invocation, saving as a workflow artifact. |
|
||||
| `generate-and-submit` | As per `generate`, but any generated dependency graph snapshots will be submitted at the end of the job. |
|
||||
| `download-and-submit` | Download any previously saved dependency graph snapshots, submitting them via the Dependency Submission API. This can be useful to collect all snapshots in a matrix of builds and submit them in one step. |
|
||||
|
||||
Example of a CI workflow that generates and submits a dependency graph:
|
||||
```yaml
|
||||
name: CI build
|
||||
on:
|
||||
push:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
- name: Build with Gradle
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run the usual CI build (dependency-graph will be generated and submitted post-job)
|
||||
run: ./gradlew build
|
||||
```
|
||||
|
||||
See the [full action documentation](docs/setup-gradle.md) for more advanced usage scenarios.
|
||||
The `contents: write` permission is required in order to submit (but not generate) the dependency graph file.
|
||||
Depending on [repository settings](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token), this permission may be available by default or may need to be explicitly enabled in the workflow file (as above).
|
||||
|
||||
## The `dependency-submission` action
|
||||
> [!IMPORTANT]
|
||||
> The above configuration will work for workflows that run as a result of commits to a repository branch,
|
||||
> but not when a workflow is triggered by a PR from a repository fork.
|
||||
> This is because the `contents: write` permission is not available when executing a workflow
|
||||
> for a PR submitted from a forked repository.
|
||||
> For a configuration that supports this setup, see [Dependency Graphs for pull request workflows](#dependency-graphs-for-pull-request-workflows).
|
||||
|
||||
Generates and submits a dependency graph for a Gradle project, allowing GitHub to alert about reported vulnerabilities in your project dependencies.
|
||||
### Using a custom plugin repository
|
||||
|
||||
The following workflow will generate a dependency graph for a Gradle project and submit it immediately to the repository via the
|
||||
Dependency Submission API. For most projects, this default configuration should be all that you need.
|
||||
|
||||
Simply add this as a new workflow file to your repository (eg `.github/workflows/dependency-submission.yml`).
|
||||
By default, the action downloads the `github-dependency-graph-gradle-plugin` from the Gradle Plugin Portal (https://plugins.gradle.org). If your GitHub Actions environment does not have access to this URL, you can specify a custom plugin repository to use.
|
||||
Do so by setting the `GRADLE_PLUGIN_REPOSITORY_URL` environment variable with your Gradle invocation.
|
||||
|
||||
```yaml
|
||||
name: Dependency Submission
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'main' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dependency-submission:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Generate and submit dependency graph
|
||||
uses: gradle/actions/dependency-submission@v4
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run a build, resolving the 'dependency-graph' plugin from the plugin portal proxy
|
||||
run: ./gradlew build
|
||||
env:
|
||||
GRADLE_PLUGIN_REPOSITORY_URL: "https://gradle-plugins-proxy.mycorp.com"
|
||||
```
|
||||
|
||||
See the [full action documentation](docs/dependency-submission.md) for more advanced usage scenarios.
|
||||
### Integrating the `dependency-review-action`
|
||||
|
||||
## The `wrapper-validation` action
|
||||
The GitHub [dependency-review-action](https://github.com/actions/dependency-review-action) helps you
|
||||
understand dependency changes (and the security impact of these changes) for a pull request.
|
||||
For the `dependency-review-action` to succeed, it must run _after_ the dependency graph has been submitted for a PR.
|
||||
|
||||
The `wrapper-validation` action validates the checksums of _all_ [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) JAR files present in the repository and fails if any unknown Gradle Wrapper JAR files are found.
|
||||
When using `generate-and-submit`, dependency graph files are submitted at the end of the job, after all steps have been
|
||||
executed. For this reason, the `dependency-review-action` must be executed in a dependent job,
|
||||
and not as a subsequent step in the job that generates the dependency graph.
|
||||
|
||||
The action should be run in the root of the repository, as it will recursively search for any files named `gradle-wrapper.jar`.
|
||||
|
||||
Starting with v4 the `setup-gradle` action will [perform wrapper validation](docs/setup-gradle.md#gradle-wrapper-validation) on each execution.
|
||||
If you are using `setup-gradle` in your workflows, it is unlikely that you will need to use the `wrapper-validation` action.
|
||||
|
||||
### Example workflow
|
||||
Example of a pull request workflow that executes a build for a pull request and runs the `dependency-review-action`:
|
||||
|
||||
```yaml
|
||||
name: "Validate Gradle Wrapper"
|
||||
name: PR check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
# Note that this permission will not be available if the PR is from a forked repository
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run a build and generate the dependency graph which will be submitted post-job
|
||||
run: ./gradlew build
|
||||
|
||||
dependency-review:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
- name: Perform dependency review
|
||||
uses: actions/dependency-review-action@v3
|
||||
```
|
||||
|
||||
See [Dependency Graphs for pull request workflows](#dependency-graphs-for-pull-request-workflows) for a more complex
|
||||
(and less functional) example that will work for pull requests submitted from forked repositories.
|
||||
|
||||
## Limiting the scope of the dependency graph
|
||||
|
||||
At times it is helpful to limit the dependencies reported to GitHub, in order to security alerts for dependencies that don't form a critical part of your product.
|
||||
For example, a vulnerability in the tool you use to generate documentation is unlikely to be as important as a vulnerability in one of your runtime dependencies.
|
||||
|
||||
There are a number of techniques you can employ to limit the scope of the generated dependency graph:
|
||||
- [Don't generate a dependency graph for all Gradle executions](#choosing-which-gradle-invocations-will-generate-a-dependency-graph)
|
||||
- [For a Gradle execution, filter which Gradle projects and configurations will contribute dependencies](#filtering-which-gradle-configurations-contribute-to-the-dependency-graph)
|
||||
- [Use a separate workflow that only resolves the required dependencies](#use-a-dedicated-workflow-for-dependency-graph-generation)
|
||||
|
||||
> [!NOTE]
|
||||
> Ideally, all dependencies involved in building and testing a project will be extracted and reported in a dependency graph.
|
||||
> These dependencies would be assigned to different scopes (eg development, runtime, testing) and the GitHub UI would make it easy to opt-in to security alerts for different dependency scopes.
|
||||
> However, this functionality does not yet exist.
|
||||
|
||||
### Choosing which Gradle invocations will generate a dependency graph
|
||||
|
||||
Once you enable the dependency graph support for a workflow job (via the `dependency-graph` parameter), dependencies will be collected and reported for all subsequent Gradle invocations.
|
||||
If you have a Gradle build step that you want to exclude from dependency graph generation, you can set the `GITHUB_DEPENDENCY_GRAPH_ENABLED` environment variable to `false`.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Build the app, generating a graph of dependencies required
|
||||
run: ./gradlew :my-app:assemble
|
||||
- name: Run all checks, disabling dependency graph generation
|
||||
run: ./gradlew check
|
||||
env:
|
||||
GITHUB_DEPENDENCY_GRAPH_ENABLED: false
|
||||
```
|
||||
|
||||
### Filtering which Gradle Configurations contribute to the dependency graph
|
||||
|
||||
If you do not want the dependency graph to include every dependency configuration in every project in your build, you can limit the
|
||||
dependency extraction to a subset of these.
|
||||
|
||||
To restrict which Gradle subprojects contribute to the report, specify which projects to include via a regular expression.
|
||||
You can provide this value via the `DEPENDENCY_GRAPH_INCLUDE_PROJECTS` environment variable or system property.
|
||||
|
||||
To restrict which Gradle configurations contribute to the report, you can filter configurations by name using a regular expression.
|
||||
You can provide this value via the `DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS` environment variable or system property.
|
||||
|
||||
For example, if you want to exclude dependencies in the `buildSrc` project, and only report on dependencies from the `runtimeClasspath` configuration,
|
||||
you would use the following configuration:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run a build, generating the dependency graph from any resolved 'runtimeClasspath' configurations
|
||||
run: ./gradlew build
|
||||
env:
|
||||
DEPENDENCY_GRAPH_INCLUDE_PROJECTS: "^:(?!buildSrc).*"
|
||||
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: runtimeClasspath
|
||||
```
|
||||
|
||||
### Use a dedicated workflow for dependency graph generation
|
||||
|
||||
Instead of generating a dependency graph from your existing CI workflow, it's possible to create a separate dedicated workflow (or Job) that is intended for generating a dependency graph.
|
||||
Such a workflow will still need to execute Gradle, but can do so in a way that is targeted at resolving the specific dependencies required.
|
||||
|
||||
For example, the following workflow will report those dependencies that are resolved in order to build the `distributionZip` for the `my-app` project. Test dependencies and other dependencies not required by the `distributionZip` will not be included.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Build the distribution Zip for `my-app`
|
||||
run: ./gradlew :my-app:distributionZip
|
||||
```
|
||||
|
||||
Note that the above example will also include any `buildSrc` dependencies, dependencies resolved when configuring your Gradle build or dependencies resolved while applying plugin. All of these dependencies are resolved in the process of running the `distributionZip` task, and thus will form part of the generated dependency graph.
|
||||
|
||||
If this isn't desirable, you will still need to use the filtering mechanism described above.
|
||||
|
||||
## Dependency Graphs for pull request workflows
|
||||
|
||||
This `contents: write` permission is not available for any workflow that is triggered by a pull request submitted from a forked repository, since it would permit a malicious pull request to make repository changes.
|
||||
|
||||
Because of this restriction, it is not possible to `generate-and-submit` a dependency graph generated for a pull-request that comes from a repository fork. In order to do so, 2 workflows will be required:
|
||||
1. The first workflow runs directly against the pull request sources and will generate the dependency graph snapshot.
|
||||
2. The second workflow is triggered on `workflow_run` of the first workflow, and will submit the previously saved dependency snapshots.
|
||||
|
||||
Note: when `download-and-submit` is used in a workflow triggered via [workflow_run](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run), the action will download snapshots saved in the triggering workflow.
|
||||
|
||||
***Main workflow file***
|
||||
```yaml
|
||||
name: run-build-and-generate-dependency-snapshot
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: "Validation"
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/actions/wrapper-validation@v4
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate # Only generate in this job
|
||||
- name: Run a build, generating the dependency graph snapshot which will be submitted
|
||||
run: ./gradlew build
|
||||
```
|
||||
|
||||
See the [full action documentation](docs/wrapper-validation.md) for more advanced usage scenarios.
|
||||
***Dependent workflow file***
|
||||
```yaml
|
||||
name: submit-dependency-snapshot
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['run-build-and-generate-dependency-snapshot']
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
submit-dependency-graph:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Retrieve dependency graph artifact and submit
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: download-and-submit
|
||||
```
|
||||
|
||||
### Integrating `dependency-review-action` for pull request workflows
|
||||
|
||||
The GitHub [dependency-review-action](https://github.com/actions/dependency-review-action) helps you
|
||||
understand dependency changes (and the security impact of these changes) for a pull request.
|
||||
|
||||
To integrate the `dependency-review-action` into the pull request workflows above, a separate workflow should be added.
|
||||
This workflow will be triggered directly on `pull_request`, but will need to wait until the dependency graph results are
|
||||
submitted before the dependency review can complete. How long to wait is controlled by the `retry-on-snapshot-warnings` input parameters.
|
||||
|
||||
Here's an example of a separate "Dependency Review" workflow that will wait for 10 minutes for the PR check workflow to complete.
|
||||
|
||||
```yaml
|
||||
name: dependency-review
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@v3
|
||||
with:
|
||||
retry-on-snapshot-warnings: true
|
||||
retry-on-snapshot-warnings-timeout: 600
|
||||
```
|
||||
|
||||
The `retry-on-snapshot-warnings-timeout` (in seconds) needs to be long enough to allow the entire `run-build-and-generate-dependency-snapshot` and `submit-dependency-snapshot` workflows (above) to complete.
|
||||
|
||||
## Gradle version compatibility
|
||||
|
||||
The GitHub Dependency Graph plugin should be compatible with all versions of Gradle >= 5.0, and has been tested against
|
||||
Gradle versions "5.6.4", "6.9.4", "7.0.2", "7.6.2", "8.0.2" and the current Gradle release.
|
||||
|
||||
The plugin is compatible with running Gradle with the configuration-cache enabled. However, this support is
|
||||
limited to Gradle "8.1.0" and later:
|
||||
- With Gradle "8.0", the build should run successfully, but an empty dependency graph will be generated.
|
||||
- With Gradle <= "7.6.4", the plugin will cause the build to fail with configuration-cache enabled.
|
||||
|
||||
To use this plugin with versions of Gradle older than "8.1.0", you'll need to invoke Gradle with the
|
||||
configuration-cache disabled.
|
||||
|
||||
## Reducing storage costs for saved dependency graph artifacts
|
||||
|
||||
When `generate` or `generate-and-submit` is used with the action, the dependency graph that is generated is stored as a workflow artifact.
|
||||
By default, these artifacts are retained for a period of 30 days (or as configured for the repository).
|
||||
To reduce storage costs for these artifacts, you can set the `artifact-retention-days` value to a lower number.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: Generate dependency graph, but only retain artifact for one day
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate
|
||||
artifact-retention-days: 1
|
||||
```
|
||||
|
||||
|
||||
|
||||
# Gradle Enterprise plugin injection
|
||||
|
||||
The `gradle-build-action` provides support for injecting and configuring the Gradle Enterprise Gradle plugin into any Gradle build, without any modification to the project sources.
|
||||
This is achieved via an init-script installed into Gradle User Home, which is enabled and parameterized via environment variables.
|
||||
|
||||
The same auto-injection behavior is available for the Common Custom User Data Gradle plugin, which enriches any build scans published with additional useful information.
|
||||
|
||||
## Enabling Gradle Enterprise injection
|
||||
|
||||
In order to enable Gradle Enterprise for your build, you must provide the required configuration via environment variables.
|
||||
|
||||
Here's a minimal example:
|
||||
|
||||
```yaml
|
||||
name: Run build with Gradle Enterprise injection
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_INJECTION_ENABLED: true
|
||||
GRADLE_ENTERPRISE_URL: https://ge.gradle.org
|
||||
GRADLE_ENTERPRISE_PLUGIN_VERSION: 3.16.1
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_KEY }} # Required to publish scans to ge.gradle.org
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: Run a Gradle build with Gradle Enterprise injection enabled
|
||||
run: ./gradlew build
|
||||
```
|
||||
|
||||
This configuration will automatically apply `v3.16.1` of the [Gradle Enterprise Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/), and publish build scans to https://ge.gradle.org.
|
||||
|
||||
Note that the `ge.gradle.org` server requires authentication in order to publish scans. The provided `GRADLE_ENTERPRISE_ACCESS_KEY` isn't required by the Gradle Enterprise injection script,
|
||||
but will be used by the GE plugin in order to authenticate with the server.
|
||||
|
||||
## Configuring Gradle Enterprise injection
|
||||
|
||||
The `init-script` supports a number of additional configuration parameters that you may fine useful. All configuration options (required and optional) are detailed below:
|
||||
|
||||
| Variable | Required | Description |
|
||||
| --- | --- | --- |
|
||||
| GRADLE_ENTERPRISE_INJECTION_ENABLED | :white_check_mark: | enables Gradle Enterprise injection |
|
||||
| GRADLE_ENTERPRISE_URL | :white_check_mark: | the URL of the Gradle Enterprise server |
|
||||
| GRADLE_ENTERPRISE_ALLOW_UNTRUSTED_SERVER | | allow communication with an untrusted server; set to _true_ if your Gradle Enterprise instance is using a self-signed certificate |
|
||||
| GRADLE_ENTERPRISE_ENFORCE_URL | | enforce the configured Gradle Enterprise URL over a URL configured in the project's build; set to _true_ to enforce publication of build scans to the configured Gradle Enterprise URL |
|
||||
| GRADLE_ENTERPRISE_PLUGIN_VERSION | :white_check_mark: | the version of the [Gradle Enterprise Gradle plugin](https://docs.gradle.com/enterprise/gradle-plugin/) to apply |
|
||||
| GRADLE_ENTERPRISE_CCUD_PLUGIN_VERSION | | the version of the [Common Custom User Data Gradle plugin](https://github.com/gradle/common-custom-user-data-gradle-plugin) to apply, if any |
|
||||
| GRADLE_ENTERPRISE_PLUGIN_REPOSITORY_URL | | the URL of the repository to use when resolving the GE and CCUD plugins; the Gradle Plugin Portal is used by default |
|
||||
|
||||
## Publishing to scans.gradle.com
|
||||
|
||||
Gradle Enterprise injection is designed to enable publishing of build scans to a Gradle Enterprise instance,
|
||||
and is not suitable for publishing to the public Build Scans instance (https://scans.gradle.com).
|
||||
|
||||
In order to publish Build Scans to scans.gradle.com, you need to:
|
||||
- Apply the Gradle Enterprise plugin to your build configuration ([see docs](https://docs.gradle.com/enterprise/get-started/#applying_the_plugin))
|
||||
- Programmatically accept the Terms of Service for scans.gradle.com ([see docs](https://docs.gradle.com/enterprise/gradle-plugin/#connecting_to_scans_gradle_com))
|
||||
- Execute the build with `--scan` or configure your build with `publishAlways()` ([see docs](https://docs.gradle.com/enterprise/get-started/#always_publishing_a_build_scan))
|
||||
|
||||
|
32
RELEASING.md
32
RELEASING.md
@ -1,32 +0,0 @@
|
||||
# Gradle GitHub Actions release process
|
||||
|
||||
## Preparation
|
||||
- Push any outstanding changes to branch main.
|
||||
- Check that https://github.com/gradle/actions/actions is green for all workflows for the main branch.
|
||||
- This should include any workflows triggered by `[bot] Update dist directory`
|
||||
- Decide on the version number to use for the release. The action releases should follow semantic versioning.
|
||||
- By default, a patch release is assumed (eg. `4.0.0` → `4.0.1`)
|
||||
- If new features have been added, bump the minor version (eg `4.1.1` → `4.2.0`)
|
||||
- If a new major release is required, bump the major version (eg `4.1.1` → `5.0.0`)
|
||||
- Note: The gradle actions follow the GitHub Actions convention of including a .0 patch number for the first release of a minor version, unlike the Gradle convention which omits the trailing .0.
|
||||
|
||||
## Release gradle/actions
|
||||
- Create a tag for the release. The tag should have the format `v4.1.0`
|
||||
- From CLI: `git tag -s -m "v4.1.0" v4.1.0 && git push --tags`
|
||||
- Note that we sign the tag and set the commit message for the tag to the newly released version.
|
||||
- Go to https://github.com/gradle/actions/releases and "Draft new release"
|
||||
- Use the newly created tag and copy the tag name exactly as the release title.
|
||||
- Craft release notes content based on issues closed, PRs merged and commits
|
||||
- Include a Full changelog link in the format https://github.com/gradle/actions/compare/v2.12.0...v3.0.0
|
||||
- Publish the release.
|
||||
- Force push the `v4` tag (or current major version) to point to the new release. It is conventional for users to bind to a major release version using this tag.
|
||||
- From CLI: `git tag -f -s -a -m "v4.0.0" v4 v4.0.0 && git push -f --tags`
|
||||
- Note that we sign the tag and set the commit message for the tag to the newly released version.
|
||||
|
||||
## Post release steps
|
||||
|
||||
Submit PRs to update the GitHub starter workflow. Starter workflows contain content that should reference the Git hash of the current gradle/actions release:
|
||||
https://github.com/actions/starter-workflows has [gradle](https://github.com/actions/starter-workflows/blob/main/ci/gradle.yml) and [gradle-publish](https://github.com/actions/starter-workflows/blob/main/ci/gradle-publish.yml): see [the v4.0.0 update PR](https://github.com/actions/starter-workflows/pull/2468) for an example.
|
||||
|
||||
Submit PRs to update the GitHub documentation. The documentation contains content that should reference the Git hash of the current gradle/actions release:
|
||||
https://github.com/github/docs has [building-and-testing-java-with-gradle](https://github.com/github/docs/blob/main/content/actions/automating-builds-and-tests/building-and-testing-java-with-gradle.md) and [publishing-java-packages-with-gradle](https://github.com/github/docs/blob/main/content/actions/publishing-packages/publishing-java-packages-with-gradle.md) : see [the v4.0.0 update PR](https://github.com/github/docs/pull/34239) for an example.
|
127
action.yml
127
action.yml
@ -1,13 +1,124 @@
|
||||
name: Build with Gradle
|
||||
description: A collection of actions for building Gradle projects, as well as generating a dependency graph via Dependency Submission.
|
||||
name: "Gradle Build Action"
|
||||
description: 'Configures Gradle for GitHub actions, caching state and generating a dependency graph via Dependency Submission.'
|
||||
|
||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||
|
||||
inputs:
|
||||
gradle-version:
|
||||
description: Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
|
||||
required: false
|
||||
|
||||
cache-disabled:
|
||||
description: When 'true', all caching is disabled. No entries will be written to or read from the cache.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
cache-read-only:
|
||||
description: |
|
||||
When 'true', existing entries will be read from the cache but no entries will be written.
|
||||
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
||||
required: false
|
||||
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
|
||||
|
||||
cache-write-only:
|
||||
description: |
|
||||
When 'true', entries will not be restored from the cache but will be saved at the end of the Job.
|
||||
Setting this to 'true' implies cache-read-only will be 'false'.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
cache-overwrite-existing:
|
||||
description: When 'true', a pre-existing Gradle User Home will not prevent the cache from being restored.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
cache-encryption-key:
|
||||
description: |
|
||||
A base64 encoded AES key used to encrypt the configuration-cache data. The key is exported as 'GRADLE_ENCRYPTION_KEY' for later steps.
|
||||
A suitable key can be generated with `openssl rand -base64 16`.
|
||||
Configuration-cache data will not be saved/restored without an encryption key being provided.
|
||||
required: false
|
||||
|
||||
gradle-home-cache-includes:
|
||||
description: Paths within Gradle User Home to cache.
|
||||
required: false
|
||||
default: |
|
||||
caches
|
||||
notifications
|
||||
|
||||
gradle-home-cache-excludes:
|
||||
description: Paths within Gradle User Home to exclude from cache.
|
||||
required: false
|
||||
# e.g. Use the following setting to prevent the local build cache from being saved/restored
|
||||
# gradle-home-cache-excludes: |
|
||||
# caches/build-cache-1
|
||||
|
||||
gradle-home-cache-cleanup:
|
||||
description: 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.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
generate-job-summary:
|
||||
description: When 'false', no Job Summary will be generated for the Job.
|
||||
required: false
|
||||
default: true
|
||||
|
||||
dependency-graph:
|
||||
description: Specifies if a GitHub dependency snapshot should be generated for each Gradle build, and if so, how. Valid values are 'disabled' (default), 'generate', 'generate-and-submit', 'generate-and-upload' and 'download-and-submit'.
|
||||
required: false
|
||||
default: 'disabled'
|
||||
|
||||
artifact-retention-days:
|
||||
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.
|
||||
required: false
|
||||
|
||||
# DEPRECATED ACTION INPUTS
|
||||
arguments:
|
||||
description: Gradle command line arguments (supports multi-line input)
|
||||
required: false
|
||||
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.
|
||||
|
||||
build-root-directory:
|
||||
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
|
||||
required: false
|
||||
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.
|
||||
|
||||
gradle-executable:
|
||||
description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
|
||||
required: false
|
||||
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.
|
||||
|
||||
# EXPERIMENTAL & INTERNAL ACTION INPUTS
|
||||
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
||||
# 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!
|
||||
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
|
||||
default: ${{ toJSON(matrix) }}
|
||||
|
||||
github-token:
|
||||
description: The GitHub token used to authenticate when submitting via the Dependency Submission API.
|
||||
default: ${{ github.token }}
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
build-scan-url:
|
||||
description: Link to the Build Scan® generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||
dependency-graph-file:
|
||||
description: Path to the GitHub Dependency Graph snapshot file generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||
gradle-version:
|
||||
description: Version of Gradle that was setup by the action
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
echo "::error::The path 'gradle/actions' is not a valid action. Please use 'gradle/actions/setup-gradle' or 'gradle/actions/dependency-submission'."
|
||||
exit 1
|
||||
shell: bash
|
||||
using: 'node20'
|
||||
main: 'dist/main/index.js'
|
||||
post: 'dist/post/index.js'
|
||||
|
||||
branding:
|
||||
icon: 'box'
|
||||
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"path": "sources"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
24
actions/clear-dependency-graph/action.yml
Normal file
24
actions/clear-dependency-graph/action.yml
Normal file
@ -0,0 +1,24 @@
|
||||
name: 'Clear dependency graph for a correlator'
|
||||
|
||||
inputs:
|
||||
job-correlator:
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set current timestamp as env variable
|
||||
shell: bash
|
||||
run: echo "NOW=$(date -Iseconds)" >> $GITHUB_ENV
|
||||
- name: Submit empty dependency graph
|
||||
shell: bash
|
||||
run: |
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ github.token }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/${{ github.repository }}/dependency-graph/snapshots \
|
||||
-d '{ "version" : 0, "job" : { "id" : "${{ github.run_id }}", "correlator" : "${{ inputs.job-correlator }} " }, "sha" : "${{ github.sha }}", "ref" : "${{ github.ref }}", "detector" : { "name" : "GitHub Dependency Graph Gradle Plugin", "version" : "0.0.3", "url" : "https://github.com/gradle/github-dependency-graph-gradle-plugin" }, "manifests" : {}, "scanned" : "${{ env.NOW }}" }'
|
||||
- run: echo "::notice ::Cleared dependency graph for job correlator '${{ inputs.job-correlator }}'"
|
||||
shell: bash
|
46
build
46
build
@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd sources
|
||||
|
||||
if [[ -f ~/.gradle/develocity/keys.properties ]]; then
|
||||
export NODE_OPTIONS='-r @gradle/develocity-agent/preload'
|
||||
export DEVELOCITY_URL=https://ge.solutions-team.gradle.com
|
||||
export DEVELOCITY_ACCESS_KEY=$(paste -sd ';' ~/.gradle/develocity/keys.properties)
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
all)
|
||||
npm run all
|
||||
;;
|
||||
act)
|
||||
# Build and copy outputs to the dist directory
|
||||
npm run build
|
||||
cd ..
|
||||
cp -r sources/dist .
|
||||
# Run act
|
||||
$@
|
||||
# Revert the changes to the dist directory
|
||||
git checkout -- dist
|
||||
;;
|
||||
dist)
|
||||
npm clean-install
|
||||
npm run build
|
||||
cd ..
|
||||
cp -r sources/dist .
|
||||
;;
|
||||
init-scripts)
|
||||
cd test/init-scripts
|
||||
./gradlew check
|
||||
;;
|
||||
install)
|
||||
npm clean-install
|
||||
npm run build
|
||||
;;
|
||||
test)
|
||||
shift
|
||||
npm test -- $@
|
||||
;;
|
||||
*)
|
||||
npm run build
|
||||
;;
|
||||
esac
|
@ -1,35 +0,0 @@
|
||||
## The `dependency-submission` action
|
||||
|
||||
Generates and submits a dependency graph for a Gradle project, allowing GitHub to alert about reported vulnerabilities in your project dependencies.
|
||||
|
||||
The following workflow will generate a dependency graph for a Gradle project and submit it immediately to the repository via the
|
||||
Dependency Submission API. For most projects, this default configuration should be all that you need.
|
||||
|
||||
Simply add this as a new workflow file to your repository (eg `.github/workflows/dependency-submission.yml`).
|
||||
|
||||
```yaml
|
||||
name: Dependency Submission
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dependency-submission:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Generate and submit dependency graph
|
||||
uses: gradle/actions/dependency-submission@v4
|
||||
```
|
||||
|
||||
See the [full action documentation](../docs/dependency-submission.md) for more advanced usage scenarios.
|
@ -1,231 +0,0 @@
|
||||
name: Gradle Dependency Submission
|
||||
description: Generates a dependency graph for a Gradle project and submits it via the Dependency Submission API
|
||||
|
||||
inputs:
|
||||
# Gradle execution configuration
|
||||
gradle-version:
|
||||
description: |
|
||||
Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
|
||||
If not provided, it is assumed that the project uses the Gradle Wrapper.
|
||||
required: false
|
||||
|
||||
build-root-directory:
|
||||
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
|
||||
required: false
|
||||
|
||||
dependency-resolution-task:
|
||||
description: |
|
||||
Task(s) that should be executed in order to resolve all project dependencies.
|
||||
By default, the built-in `:ForceDependencyResolutionPlugin_resolveAllDependencies` task is executed.
|
||||
required: false
|
||||
|
||||
additional-arguments:
|
||||
description: |
|
||||
Additional arguments to pass to Gradle when generating the dependency graph.
|
||||
For example, `--no-configuration-cache --stacktrace`.
|
||||
required: false
|
||||
|
||||
# Cache configuration
|
||||
cache-disabled:
|
||||
description: When 'true', all caching is disabled. No entries will be written to or read from the cache.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
cache-read-only:
|
||||
description: |
|
||||
When 'true', existing entries will be read from the cache but no entries will be written.
|
||||
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
||||
required: false
|
||||
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
|
||||
|
||||
cache-write-only:
|
||||
description: |
|
||||
When 'true', entries will not be restored from the cache but will be saved at the end of the Job.
|
||||
Setting this to 'true' implies cache-read-only will be 'false'.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
cache-overwrite-existing:
|
||||
description: When 'true', a pre-existing Gradle User Home will not prevent the cache from being restored.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
cache-encryption-key:
|
||||
description: |
|
||||
A base64 encoded AES key used to encrypt the configuration-cache data. The key is exported as 'GRADLE_ENCRYPTION_KEY' for later steps.
|
||||
A suitable key can be generated with `openssl rand -base64 16`.
|
||||
Configuration-cache data will not be saved/restored without an encryption key being provided.
|
||||
required: false
|
||||
|
||||
cache-cleanup:
|
||||
description: |
|
||||
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.
|
||||
By default ('on-success'), cleanup is performed when all Gradle builds succeed for the Job.
|
||||
This behaviour can be disabled ('never'), or configured to always run irrespective of the build outcome ('always').
|
||||
Valid values are 'never', 'on-success' and 'always'.
|
||||
required: false
|
||||
default: 'on-success'
|
||||
|
||||
gradle-home-cache-cleanup:
|
||||
description: 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.
|
||||
required: false
|
||||
deprecation-message: This input has been superceded by the 'cache-cleanup' input parameter.
|
||||
|
||||
gradle-home-cache-includes:
|
||||
description: Paths within Gradle User Home to cache.
|
||||
required: false
|
||||
default: |
|
||||
caches
|
||||
notifications
|
||||
|
||||
gradle-home-cache-excludes:
|
||||
description: Paths within Gradle User Home to exclude from cache.
|
||||
required: false
|
||||
|
||||
# Job summary configuration
|
||||
add-job-summary:
|
||||
description: Specifies when a Job Summary should be inluded in the action results. Valid values are 'never', 'always' (default), and 'on-failure'.
|
||||
required: false
|
||||
default: 'always'
|
||||
|
||||
add-job-summary-as-pr-comment:
|
||||
description: 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.
|
||||
required: false
|
||||
default: 'never'
|
||||
|
||||
# Dependency Graph configuration
|
||||
dependency-graph:
|
||||
description: |
|
||||
Specifies how the dependency-graph should be handled by this action.
|
||||
By default a dependency-graph will be generated, submitted to the dependency-submission API, and saved as a workflow artifact.
|
||||
Valid values are:
|
||||
'generate-and-submit': Generates a dependency graph for the project and submits it in the same Job.
|
||||
'generate-submit-and-upload (default)': As per 'generate-and-submit', but also saves the dependency graph as a workflow artifact.
|
||||
'generate-and-upload': Generates a dependency graph for the project and saves it as a workflow artifact. Does not submit it to the repository.
|
||||
'download-and-submit': Retrieves a previously saved dependency-graph and submits it to the repository.
|
||||
|
||||
Use `generate-and-submit` if you prefer not to save the dependency-graph as a workflow artifact.
|
||||
The `generate-and-upload` and `download-and-submit` options are designed to be used in an untrusted workflow scenario,
|
||||
where the workflow generating the dependency-graph cannot (or should not) be given the `contents: write` permissions
|
||||
required to submit via the Dependency Submission API.
|
||||
required: false
|
||||
default: 'generate-submit-and-upload'
|
||||
|
||||
dependency-graph-report-dir:
|
||||
description: |
|
||||
Specifies where the dependency graph report will be generated.
|
||||
Paths can relative or absolute. Relative paths are resolved relative to the workspace directory.
|
||||
required: false
|
||||
default: 'dependency-graph-reports'
|
||||
|
||||
dependency-graph-continue-on-failure:
|
||||
description: 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.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
dependency-graph-exclude-projects:
|
||||
description: |
|
||||
Gradle projects that should be excluded from dependency graph (regular expression).
|
||||
When set, any matching project will be excluded.
|
||||
required: false
|
||||
|
||||
dependency-graph-include-projects:
|
||||
description: |
|
||||
Gradle projects that should be included in dependency graph (regular expression).
|
||||
When set, only matching projects will be included.
|
||||
required: false
|
||||
|
||||
dependency-graph-exclude-configurations:
|
||||
description: |
|
||||
Gradle configurations that should be included in dependency graph (regular expression).
|
||||
When set, anymatching configurations will be excluded.
|
||||
required: false
|
||||
|
||||
dependency-graph-include-configurations:
|
||||
description: |
|
||||
Gradle configurations that should be included in dependency graph (regular expression).
|
||||
When set, only matching configurations will be included.
|
||||
required: false
|
||||
|
||||
artifact-retention-days:
|
||||
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.
|
||||
required: false
|
||||
|
||||
# Build Scan configuration
|
||||
build-scan-publish:
|
||||
description: |
|
||||
Set to 'true' to automatically publish build results as a Build Scan on scans.gradle.com.
|
||||
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'.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
build-scan-terms-of-use-url:
|
||||
description: 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'.
|
||||
required: false
|
||||
|
||||
build-scan-terms-of-use-agree:
|
||||
description: Indicate that you agree to the Build Scan® terms of use. This input value must be "yes".
|
||||
required: false
|
||||
|
||||
develocity-access-key:
|
||||
description: Develocity access key. Should be set to a secret containing the Develocity Access key.
|
||||
required: false
|
||||
|
||||
develocity-token-expiry:
|
||||
description: The Develocity short-lived access tokens expiry in hours. Default is 2 hours.
|
||||
required: false
|
||||
|
||||
# Wrapper validation configuration
|
||||
validate-wrappers:
|
||||
description: |
|
||||
When 'true' the action will automatically validate all wrapper jars found in the repository.
|
||||
If the wrapper checksums are not valid, the action will fail.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
allow-snapshot-wrappers:
|
||||
description: |
|
||||
When 'true', wrapper validation will include the checksums of snapshot wrapper jars.
|
||||
Use this if you are running with nightly or snapshot versions of the Gradle wrapper.
|
||||
required: false
|
||||
default: false
|
||||
|
||||
# DEPRECATED ACTION INPUTS
|
||||
|
||||
# EXPERIMENTAL ACTION INPUTS
|
||||
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
||||
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `setup-gradle`.
|
||||
# Use at your own risk!
|
||||
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
|
||||
|
||||
# INTERNAL ACTION INPUTS
|
||||
# These inputs should not be configured directly, and are only used to pass environmental information to the action
|
||||
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
|
||||
default: ${{ toJSON(matrix) }}
|
||||
|
||||
github-token:
|
||||
description: The GitHub token used to authenticate when submitting via the Dependency Submission API.
|
||||
default: ${{ github.token }}
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
build-scan-url:
|
||||
description: Link to the Build Scan® generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `setup-gradle` Step itself.
|
||||
dependency-graph-file:
|
||||
description: Path to the GitHub Dependency Graph snapshot file generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `setup-gradle` Step itself.
|
||||
gradle-version:
|
||||
description: Version of Gradle that was setup by the action
|
||||
|
||||
runs:
|
||||
using: 'node20'
|
||||
main: '../dist/dependency-submission/main/index.js'
|
||||
post: '../dist/dependency-submission/post/index.js'
|
||||
|
||||
branding:
|
||||
icon: 'box'
|
||||
color: 'gray-dark'
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user