Compare commits

...

21 Commits

Author SHA1 Message Date
bigdaz
db19848a5f [bot] Update dist directory 2024-04-25 20:24:26 +00:00
daz
941b289d84 Avoid running Gradle 3.5.1 on MacOS where Java 8 is not available 2024-04-25 21:23:15 +01:00
Daz DeBoer
bce7daca54 Improve build scan badge readability with long tasks (#200)
Improve readability of build scan when requested tasks is very long, as
agreed in #175. HTML diff for each case of job summary is clearer in
cd62d9c9ef.

- Ensure a minimum size for the badge, at least the size of "Build
scan®", by preventing a line break with ` `
- Reduce the size of the badge by tweaking the inner text

Also fix a typo in the build shell script.
2024-04-25 21:22:36 +01:00
daz
11eaed9738 Avoid Java 8 since it is not available on MacOS runners 2024-04-25 20:17:16 +01:00
Gabriel Feo
cd62d9c9ef Improve job summary readability with long tasks
Change tests for nbsp and concise badge

Make tests pass

Signed-off-by: Gabriel Feo <gabriel@gabrielfeo.com>
2024-04-25 19:40:04 +01:00
Gabriel Feo
a54fb6a5bb Add tests on current job-summary behavior
Signed-off-by: Gabriel Feo <gabriel@gabrielfeo.com>
2024-04-25 17:44:41 +01:00
Gabriel Feo
ef36f81b41 Fix typo in build shell script
Signed-off-by: Gabriel Feo <gabriel@gabrielfeo.com>
2024-04-25 17:42:29 +01:00
bigdaz
18998bc43e [bot] Update dist directory 2024-04-25 10:20:39 +00:00
daz
a772c14b33 Avoid updating real dependency graph in tests 2024-04-25 11:19:43 +01:00
daz
7763d71170 Set the report dir for download-and-submit
Fixes #196
2024-04-25 11:19:43 +01:00
bigdaz
9ab93ee864 [bot] Update dist directory 2024-04-19 16:25:39 +00:00
daz
d124ec149f Retain and log stacktrace for submission errors 2024-04-19 10:24:45 -06:00
Alex Serbin
6ccde15122 Use logger in dependency graph init script (#191)
Dependency graph init script now uses Gradle logger to emit warning/info messages.
This allows these messages to be suppressed using `--quiet`.
2024-04-19 07:03:17 -06:00
bigdaz
750cdda3ed [bot] Update dist directory 2024-04-18 19:41:35 +00:00
Daz DeBoer
c198d84863 Support custom report dir for dependency-submission (#189)
If the `DEPENDENCY_GRAPH_REPORT_DIR` var is set, use this value when locating dependency-graph files to upload/submit.

Fixes #188
2024-04-18 13:40:41 -06:00
Daz DeBoer
d211a39090 Documentation updates (#187)
* Use consistent YAML syntax in example workflows
* Add link to plugin env vars
2024-04-18 09:39:15 -06:00
bigdaz
439ed0a0ac [bot] Update dist directory 2024-04-18 01:09:48 +00:00
daz
eef9b10930 Bump Develocity and CCUD plugin versions 2024-04-17 19:08:51 -06:00
Marcono1234
8be796e9fa Update link to 'update checksums' workflow 2024-04-16 10:06:09 -06:00
daz
3c2d3b6f2a Include VS code workspace file
This workspace sets things up so that source code navigation works
propertly in VS code.
2024-04-12 15:39:30 -06:00
daz
0fa10b26b8 Update releasing guide 2024-04-12 14:01:48 -06:00
45 changed files with 675 additions and 188 deletions

View File

@@ -1,6 +1,6 @@
plugins {
id "com.gradle.develocity" version "3.17.1"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0"
id "com.gradle.develocity" version "3.17.2"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.1"
}
develocity {

View File

@@ -1,6 +1,6 @@
plugins {
id("com.gradle.develocity") version "3.17.1"
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.0"
id("com.gradle.develocity") version "3.17.2"
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.0.1"
}
develocity {

View File

@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.1"
id "com.gradle.develocity" version "3.17.2"
}
develocity {

View File

@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17.1"
id "com.gradle.develocity" version "3.17.2"
}
develocity {

View File

@@ -1,5 +1,5 @@
plugins {
id "com.gradle.develocity" version "3.17"
id "com.gradle.develocity" version "3.17.2"
}
develocity {

View File

@@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3 # Use a released version to avoid breakages
- name: Run integration tests

View File

@@ -34,7 +34,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
- name: Setup Gradle
id: setup-gradle
uses: ./setup-gradle

View File

@@ -18,6 +18,7 @@ permissions:
env:
SKIP_DIST: ${{ inputs.skip-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
jobs:
groovy-generate:

View File

@@ -1,4 +1,4 @@
name: Test dependency graph
name: Test dependency submission failures
on:
workflow_call:
@@ -15,6 +15,7 @@ on:
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
jobs:
failing-build:

View File

@@ -1,4 +1,4 @@
name: Test dependency graph
name: Test dependency submission
on:
workflow_call:
@@ -18,6 +18,7 @@ permissions:
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
jobs:
groovy-generate-and-upload:
@@ -223,8 +224,6 @@ jobs:
with:
gradle-version: ${{ matrix.gradle }}
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
after-setup-gradle:
strategy:
@@ -245,3 +244,79 @@ jobs:
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/groovy-dsl
custom-report-dir-submit:
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- 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
build-root-directory: .github/workflow-samples/groovy-dsl
env:
DEPENDENCY_GRAPH_REPORT_DIR: '${{ github.workspace }}/custom/report-dir'
- 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
custom-report-dir-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- 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
build-root-directory: .github/workflow-samples/groovy-dsl
env:
DEPENDENCY_GRAPH_REPORT_DIR: '${{ github.workspace }}/custom/report-dir'
custom-report-dir-download-and-submit:
needs: custom-report-dir-upload
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- 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
build-root-directory: .github/workflow-samples/groovy-dsl
env:
DEPENDENCY_GRAPH_REPORT_DIR: '${{ github.workspace }}/custom/report-dir'
- 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

View File

@@ -61,12 +61,17 @@ jobs:
gradle: [7.5.1, 6.9.2, 5.6.4, 4.10.3, 3.5.1]
os: ${{fromJSON(inputs.runner-os)}}
include:
- java-version: 11
- 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
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
@@ -78,7 +83,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: ${{ matrix.java-version }}
- name: Run Gradle build
uses: ./setup-gradle
id: gradle

View File

@@ -33,7 +33,7 @@ jobs:
matrix:
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
os: ${{fromJSON(inputs.runner-os)}}
plugin-version: [3.16.2, 3.17]
plugin-version: [3.16.2, 3.17.2]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
@@ -45,7 +45,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: 11
- name: Setup Gradle
id: setup-gradle
uses: ./setup-gradle

View File

@@ -76,12 +76,17 @@ jobs:
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
build-root-suffix: -gradle-5
- gradle: 4.10.3
build-root-suffix: -gradle-4
- 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
@@ -93,7 +98,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
java-version: ${{ matrix.java-version }}
- name: Setup Gradle
id: setup-gradle
uses: ./setup-gradle

View File

@@ -48,7 +48,7 @@ jobs:
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/wrapper-validation-action/actions/workflows/update-checksums-file.yml), the changes will then be force-pushed onto this pull request branch.
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]

1
.gitignore vendored
View File

@@ -1,3 +1,2 @@
.git
.vscode
actions.code-workspace

View File

@@ -15,7 +15,8 @@ The recommended way to execute any Gradle build is with the help of the [Gradle
```yaml
name: Build
on: [ push ]
on:
push:
jobs:
build:
@@ -48,7 +49,9 @@ Simply add this as a new workflow file to your repository (eg `.github/workflows
```yaml
name: Dependency Submission
on: [ push ]
on:
push:
branches: [ 'main' ]
permissions:
contents: write
@@ -80,7 +83,10 @@ The action should be run in the root of the repository, as it will recursively s
```yaml
name: "Validate Gradle Wrapper"
on: [push, pull_request]
on:
push:
pull_request:
jobs:
validation:

View File

@@ -1,8 +1,9 @@
# Gradle GitHub Actions release process
## Preparation
- Push any outstanding changes to branch main. For any change that impacts the released action, you must run npm via `./build all` and commit the various files generated into the dist directory.
- 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. `3.0.0``3.0.1`)
- If new features have been added, bump the minor version (eg `3.1.1``3.2.0`)
@@ -11,14 +12,12 @@
## Release gradle/actions
- Create a tag for the release. The tag should have the format `v3.1.0`
- From CLI: `git tag v3.1.0`
- Push the commit and tag
- From CLI: `git push --tags`
- From CLI: `git tag v3.1.0 && git push --tags`
- 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. Before using "Publish release", check that [action workflows](https://github.com/gradle/actions/actions) are green for the version tag. eg https://github.com/gradle/actions/actions?query=branch%3Av3.0.0
- Publish the release.
- Force push the `v3` 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 -a -m "v3.0.0" v3 v3.0.0 && git push -f --tags`
- Note that we set the commit message for the tag to the newly released version.
@@ -38,6 +37,21 @@ During the 3.x release series, we will continue to publish parallel releases of
- Force push the `v3` tag (or current major version) to point to the new release.
- From CLI: `git tag -f -a -m "v3.0.0" v3 v3.0.0 && git push -f --tags`
## Release gradle/wrapper-validation-action
During the 3.x release series, we will continue to publish parallel releases of `gradle/wrapper-validation-action`. These releases will simply delegate to `gradle/actions/wrapper-validation` with the same version.
- Update the [wrapper-validation-action action.yml](https://github.com/gradle/wrapper-validation-action/blob/main/action.yml#L162) file to point to the newly released version of `gradle/actions/wrapper-validation`.
- Ensure that any parameters that have been added to the `wrapper-validation` action (if any) are added to the action definition, and that these are passed on to setup-gradle.
- Create and push a tag for the release.
- From CLI: `git tag v3.1.0 && git push --tags`
- Go to https://github.com/gradle/wrapper-validation-action/releases and "Draft new release"
- Use the newly created tag and copy the tag name exactly as the release title.
- In the release notes, point users to the gradle/actions release. Include a header informing users to switch to `gradle/actions/wrapper-validation`.
- Publish the release.
- Force push the `v3` tag (or current major version) to point to the new release.
- From CLI: `git tag -f -a -m "v3.0.0" v3 v3.0.0 && git push -f --tags`
## 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:

11
actions.code-workspace Normal file
View File

@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "sources"
}
],
"settings": {}
}

4
build
View File

@@ -5,7 +5,7 @@ cd sources
case "$1" in
all)
npm clean-install
nprm run all
npm run all
;;
act)
# Build and copy outputs to the dist directory
@@ -26,4 +26,4 @@ case "$1" in
npm install
npm run build
;;
esac
esac

View File

@@ -10,7 +10,9 @@ Simply add this as a new workflow file to your repository (eg `.github/workflows
```yaml
name: Dependency Submission
on: [ push ]
on:
push:
branches: ['main']
permissions:
contents: write

View File

@@ -143003,7 +143003,7 @@ function setup(config) {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17.2');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree());
@@ -144345,6 +144345,9 @@ class DependencyGraphConfig {
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
getReportDirectory() {
return path_1.default.resolve(getWorkspaceDirectory(), 'dependency-graph-reports');
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
@@ -144683,6 +144686,7 @@ async function setup(config) {
return;
}
if (option === configuration_1.DependencyGraphOption.DownloadAndSubmit) {
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory());
await downloadAndSubmitDependencyGraphs(config);
return;
}
@@ -144694,7 +144698,7 @@ async function setup(config) {
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', (0, configuration_1.getWorkspaceDirectory)());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve((0, configuration_1.getWorkspaceDirectory)(), 'dependency-graph-reports'));
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory());
if (option === configuration_1.DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
@@ -144716,10 +144720,10 @@ async function complete(config) {
return;
case configuration_1.DependencyGraphOption.GenerateAndSubmit:
case configuration_1.DependencyGraphOption.Clear:
await submitDependencyGraphs(await findGeneratedDependencyGraphFiles());
await submitDependencyGraphs(await findDependencyGraphFiles());
return;
case configuration_1.DependencyGraphOption.GenerateAndUpload:
await uploadDependencyGraphs(await findGeneratedDependencyGraphFiles(), config);
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
}
}
catch (e) {
@@ -144727,11 +144731,11 @@ async function complete(config) {
}
}
exports.complete = complete;
async function findGeneratedDependencyGraphFiles() {
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
return await findDependencyGraphFiles(workspaceDirectory);
}
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.');
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`);
@@ -144761,6 +144765,10 @@ async function downloadAndSubmitDependencyGraphs(config) {
}
}
async function submitDependencyGraphs(dependencyGraphFiles) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to submit.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.');
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`);
@@ -144772,17 +144780,15 @@ async function submitDependencyGraphs(dependencyGraphFiles) {
}
catch (error) {
if (error instanceof request_error_1.RequestError) {
throw new Error(translateErrorMessage(dependencyGraphFile, error));
}
else {
throw error;
error.message = translateErrorMessage(dependencyGraphFile, error);
}
throw error;
}
}
}
function translateErrorMessage(jsonFile, error) {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile);
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${String(error)}`;
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${error.message}`;
if (error.message === 'Resource not accessible by integration') {
return `${mainWarning}
Please ensure that the 'contents: write' permission is available for the workflow job.
@@ -144802,7 +144808,6 @@ async function submitDependencyGraphFile(jsonFile) {
core.notice(`Submitted ${relativeJsonFile}: ${response.data.message}`);
}
async function downloadDependencyGraphs() {
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
@@ -144812,27 +144817,29 @@ async function downloadDependencyGraphs() {
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const downloadPath = path.resolve(workspaceDirectory, 'dependency-graph');
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(candidate => candidate.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
path: downloadPath,
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles(downloadPath);
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles(dir) {
const globber = await glob.create(`${dir}/dependency-graph-reports/*.json`);
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
function getReportDirectory() {
return process.env.DEPENDENCY_GRAPH_REPORT_DIR;
}
function isProcessed(dependencyGraphFile) {
const markerFile = `${dependencyGraphFile}.processed`;
return fs_1.default.existsSync(markerFile);
@@ -145089,6 +145096,9 @@ function handleMainActionError(error) {
}
else if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.setFailed(String(error));
@@ -145101,6 +145111,9 @@ exports.handleMainActionError = handleMainActionError;
function handlePostActionError(error) {
if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`);
@@ -145452,7 +145465,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
exports.renderSummaryTable = exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const request_error_1 = __nccwpck_require__(10537);
@@ -145524,6 +145537,7 @@ Note that this permission is never available for a workflow triggered from a rep
function renderSummaryTable(results) {
return `${renderDeprecations()}\n${renderBuildResults(results)}`;
}
exports.renderSummaryTable = renderSummaryTable;
function renderDeprecations() {
const deprecations = (0, deprecation_collector_1.getDeprecations)();
if (deprecations.length === 0) {
@@ -145552,7 +145566,7 @@ function renderBuildResults(results) {
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build Scan®</th>
<th>Build&nbsp;Scan®</th>
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
</table>
`;
@@ -145572,16 +145586,35 @@ function renderOutcome(result) {
}
function renderBuildScan(result) {
if (result.buildScanFailed) {
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting');
return renderBuildScanBadge({
text: 'Publish failed',
alt: 'Build Scan publish failed',
color: 'orange',
logo: false,
targetUrl: 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
});
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
return renderBuildScanBadge({
text: 'Build Scan®',
alt: 'Build Scan published',
color: '06A0CE',
logo: true,
targetUrl: result.buildScanUri
});
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
return renderBuildScanBadge({
text: 'Not published',
alt: 'Build Scan not published',
color: 'lightgrey',
logo: false,
targetUrl: 'https://scans.gradle.com'
});
}
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
function renderBuildScanBadge({ text, alt, color, logo, targetUrl }) {
const encodedText = encodeURIComponent(text);
const badgeUrl = `https://img.shields.io/badge/${encodedText}-${color}${logo ? '?logo=Gradle' : ''}`;
const badgeHtml = `<img src="${badgeUrl}" alt="${alt}" />`;
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`;
}
function truncateString(str, maxLength) {

File diff suppressed because one or more lines are too long

View File

@@ -94431,7 +94431,7 @@ function setup(config) {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17.2');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree());
@@ -95773,6 +95773,9 @@ class DependencyGraphConfig {
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
getReportDirectory() {
return path_1.default.resolve(getWorkspaceDirectory(), 'dependency-graph-reports');
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
@@ -96250,6 +96253,9 @@ function handleMainActionError(error) {
}
else if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.setFailed(String(error));
@@ -96262,6 +96268,9 @@ exports.handleMainActionError = handleMainActionError;
function handlePostActionError(error) {
if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`);
@@ -96304,7 +96313,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
exports.renderSummaryTable = exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438));
const request_error_1 = __nccwpck_require__(537);
@@ -96376,6 +96385,7 @@ Note that this permission is never available for a workflow triggered from a rep
function renderSummaryTable(results) {
return `${renderDeprecations()}\n${renderBuildResults(results)}`;
}
exports.renderSummaryTable = renderSummaryTable;
function renderDeprecations() {
const deprecations = (0, deprecation_collector_1.getDeprecations)();
if (deprecations.length === 0) {
@@ -96404,7 +96414,7 @@ function renderBuildResults(results) {
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build Scan®</th>
<th>Build&nbsp;Scan®</th>
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
</table>
`;
@@ -96424,16 +96434,35 @@ function renderOutcome(result) {
}
function renderBuildScan(result) {
if (result.buildScanFailed) {
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting');
return renderBuildScanBadge({
text: 'Publish failed',
alt: 'Build Scan publish failed',
color: 'orange',
logo: false,
targetUrl: 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
});
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
return renderBuildScanBadge({
text: 'Build Scan®',
alt: 'Build Scan published',
color: '06A0CE',
logo: true,
targetUrl: result.buildScanUri
});
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
return renderBuildScanBadge({
text: 'Not published',
alt: 'Build Scan not published',
color: 'lightgrey',
logo: false,
targetUrl: 'https://scans.gradle.com'
});
}
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
function renderBuildScanBadge({ text, alt, color, logo, targetUrl }) {
const encodedText = encodeURIComponent(text);
const badgeUrl = `https://img.shields.io/badge/${encodedText}-${color}${logo ? '?logo=Gradle' : ''}`;
const badgeHtml = `<img src="${badgeUrl}" alt="${alt}" />`;
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`;
}
function truncateString(str, maxLength) {

File diff suppressed because one or more lines are too long

View File

@@ -143003,7 +143003,7 @@ function setup(config) {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17.2');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree());
@@ -144345,6 +144345,9 @@ class DependencyGraphConfig {
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
getReportDirectory() {
return path_1.default.resolve(getWorkspaceDirectory(), 'dependency-graph-reports');
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
@@ -144683,6 +144686,7 @@ async function setup(config) {
return;
}
if (option === configuration_1.DependencyGraphOption.DownloadAndSubmit) {
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory());
await downloadAndSubmitDependencyGraphs(config);
return;
}
@@ -144694,7 +144698,7 @@ async function setup(config) {
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', (0, configuration_1.getWorkspaceDirectory)());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve((0, configuration_1.getWorkspaceDirectory)(), 'dependency-graph-reports'));
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory());
if (option === configuration_1.DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
@@ -144716,10 +144720,10 @@ async function complete(config) {
return;
case configuration_1.DependencyGraphOption.GenerateAndSubmit:
case configuration_1.DependencyGraphOption.Clear:
await submitDependencyGraphs(await findGeneratedDependencyGraphFiles());
await submitDependencyGraphs(await findDependencyGraphFiles());
return;
case configuration_1.DependencyGraphOption.GenerateAndUpload:
await uploadDependencyGraphs(await findGeneratedDependencyGraphFiles(), config);
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
}
}
catch (e) {
@@ -144727,11 +144731,11 @@ async function complete(config) {
}
}
exports.complete = complete;
async function findGeneratedDependencyGraphFiles() {
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
return await findDependencyGraphFiles(workspaceDirectory);
}
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.');
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`);
@@ -144761,6 +144765,10 @@ async function downloadAndSubmitDependencyGraphs(config) {
}
}
async function submitDependencyGraphs(dependencyGraphFiles) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to submit.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.');
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`);
@@ -144772,17 +144780,15 @@ async function submitDependencyGraphs(dependencyGraphFiles) {
}
catch (error) {
if (error instanceof request_error_1.RequestError) {
throw new Error(translateErrorMessage(dependencyGraphFile, error));
}
else {
throw error;
error.message = translateErrorMessage(dependencyGraphFile, error);
}
throw error;
}
}
}
function translateErrorMessage(jsonFile, error) {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile);
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${String(error)}`;
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${error.message}`;
if (error.message === 'Resource not accessible by integration') {
return `${mainWarning}
Please ensure that the 'contents: write' permission is available for the workflow job.
@@ -144802,7 +144808,6 @@ async function submitDependencyGraphFile(jsonFile) {
core.notice(`Submitted ${relativeJsonFile}: ${response.data.message}`);
}
async function downloadDependencyGraphs() {
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
@@ -144812,27 +144817,29 @@ async function downloadDependencyGraphs() {
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const downloadPath = path.resolve(workspaceDirectory, 'dependency-graph');
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(candidate => candidate.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
path: downloadPath,
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles(downloadPath);
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles(dir) {
const globber = await glob.create(`${dir}/dependency-graph-reports/*.json`);
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
function getReportDirectory() {
return process.env.DEPENDENCY_GRAPH_REPORT_DIR;
}
function isProcessed(dependencyGraphFile) {
const markerFile = `${dependencyGraphFile}.processed`;
return fs_1.default.existsSync(markerFile);
@@ -145017,6 +145024,9 @@ function handleMainActionError(error) {
}
else if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.setFailed(String(error));
@@ -145029,6 +145039,9 @@ exports.handleMainActionError = handleMainActionError;
function handlePostActionError(error) {
if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`);
@@ -145380,7 +145393,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
exports.renderSummaryTable = exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const request_error_1 = __nccwpck_require__(10537);
@@ -145452,6 +145465,7 @@ Note that this permission is never available for a workflow triggered from a rep
function renderSummaryTable(results) {
return `${renderDeprecations()}\n${renderBuildResults(results)}`;
}
exports.renderSummaryTable = renderSummaryTable;
function renderDeprecations() {
const deprecations = (0, deprecation_collector_1.getDeprecations)();
if (deprecations.length === 0) {
@@ -145480,7 +145494,7 @@ function renderBuildResults(results) {
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build Scan®</th>
<th>Build&nbsp;Scan®</th>
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
</table>
`;
@@ -145500,16 +145514,35 @@ function renderOutcome(result) {
}
function renderBuildScan(result) {
if (result.buildScanFailed) {
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting');
return renderBuildScanBadge({
text: 'Publish failed',
alt: 'Build Scan publish failed',
color: 'orange',
logo: false,
targetUrl: 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
});
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
return renderBuildScanBadge({
text: 'Build Scan®',
alt: 'Build Scan published',
color: '06A0CE',
logo: true,
targetUrl: result.buildScanUri
});
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
return renderBuildScanBadge({
text: 'Not published',
alt: 'Build Scan not published',
color: 'lightgrey',
logo: false,
targetUrl: 'https://scans.gradle.com'
});
}
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
function renderBuildScanBadge({ text, alt, color, logo, targetUrl }) {
const encodedText = encodeURIComponent(text);
const badgeUrl = `https://img.shields.io/badge/${encodedText}-${color}${logo ? '?logo=Gradle' : ''}`;
const badgeHtml = `<img src="${badgeUrl}" alt="${alt}" />`;
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`;
}
function truncateString(str, maxLength) {

File diff suppressed because one or more lines are too long

View File

@@ -140456,7 +140456,7 @@ function setup(config) {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17.2');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree());
@@ -141798,6 +141798,9 @@ class DependencyGraphConfig {
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
getReportDirectory() {
return path_1.default.resolve(getWorkspaceDirectory(), 'dependency-graph-reports');
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
@@ -142136,6 +142139,7 @@ async function setup(config) {
return;
}
if (option === configuration_1.DependencyGraphOption.DownloadAndSubmit) {
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory());
await downloadAndSubmitDependencyGraphs(config);
return;
}
@@ -142147,7 +142151,7 @@ async function setup(config) {
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', (0, configuration_1.getWorkspaceDirectory)());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve((0, configuration_1.getWorkspaceDirectory)(), 'dependency-graph-reports'));
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory());
if (option === configuration_1.DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
@@ -142169,10 +142173,10 @@ async function complete(config) {
return;
case configuration_1.DependencyGraphOption.GenerateAndSubmit:
case configuration_1.DependencyGraphOption.Clear:
await submitDependencyGraphs(await findGeneratedDependencyGraphFiles());
await submitDependencyGraphs(await findDependencyGraphFiles());
return;
case configuration_1.DependencyGraphOption.GenerateAndUpload:
await uploadDependencyGraphs(await findGeneratedDependencyGraphFiles(), config);
await uploadDependencyGraphs(await findDependencyGraphFiles(), config);
}
}
catch (e) {
@@ -142180,11 +142184,11 @@ async function complete(config) {
}
}
exports.complete = complete;
async function findGeneratedDependencyGraphFiles() {
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
return await findDependencyGraphFiles(workspaceDirectory);
}
async function uploadDependencyGraphs(dependencyGraphFiles, config) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.');
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`);
@@ -142214,6 +142218,10 @@ async function downloadAndSubmitDependencyGraphs(config) {
}
}
async function submitDependencyGraphs(dependencyGraphFiles) {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to submit.');
return;
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.');
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`);
@@ -142225,17 +142233,15 @@ async function submitDependencyGraphs(dependencyGraphFiles) {
}
catch (error) {
if (error instanceof request_error_1.RequestError) {
throw new Error(translateErrorMessage(dependencyGraphFile, error));
}
else {
throw error;
error.message = translateErrorMessage(dependencyGraphFile, error);
}
throw error;
}
}
}
function translateErrorMessage(jsonFile, error) {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile);
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${String(error)}`;
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${error.message}`;
if (error.message === 'Resource not accessible by integration') {
return `${mainWarning}
Please ensure that the 'contents: write' permission is available for the workflow job.
@@ -142255,7 +142261,6 @@ async function submitDependencyGraphFile(jsonFile) {
core.notice(`Submitted ${relativeJsonFile}: ${response.data.message}`);
}
async function downloadDependencyGraphs() {
const workspaceDirectory = (0, configuration_1.getWorkspaceDirectory)();
const findBy = github.context.payload.workflow_run
? {
token: (0, configuration_1.getGithubToken)(),
@@ -142265,27 +142270,29 @@ async function downloadDependencyGraphs() {
}
: undefined;
const artifactClient = new artifact_1.DefaultArtifactClient();
const downloadPath = path.resolve(workspaceDirectory, 'dependency-graph');
const dependencyGraphArtifacts = (await artifactClient.listArtifacts({
latest: true,
findBy
})).artifacts.filter(candidate => candidate.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
})).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX));
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
path: downloadPath,
findBy
});
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`);
}
return findDependencyGraphFiles(downloadPath);
return findDependencyGraphFiles();
}
async function findDependencyGraphFiles(dir) {
const globber = await glob.create(`${dir}/dependency-graph-reports/*.json`);
async function findDependencyGraphFiles() {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`);
const allFiles = await globber.glob();
const unprocessedFiles = allFiles.filter(file => !isProcessed(file));
unprocessedFiles.forEach(markProcessed);
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`);
return unprocessedFiles;
}
function getReportDirectory() {
return process.env.DEPENDENCY_GRAPH_REPORT_DIR;
}
function isProcessed(dependencyGraphFile) {
const markerFile = `${dependencyGraphFile}.processed`;
return fs_1.default.existsSync(markerFile);
@@ -142470,6 +142477,9 @@ function handleMainActionError(error) {
}
else if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.setFailed(String(error));
@@ -142482,6 +142492,9 @@ exports.handleMainActionError = handleMainActionError;
function handlePostActionError(error) {
if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`);
@@ -142524,7 +142537,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
exports.renderSummaryTable = exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const request_error_1 = __nccwpck_require__(10537);
@@ -142596,6 +142609,7 @@ Note that this permission is never available for a workflow triggered from a rep
function renderSummaryTable(results) {
return `${renderDeprecations()}\n${renderBuildResults(results)}`;
}
exports.renderSummaryTable = renderSummaryTable;
function renderDeprecations() {
const deprecations = (0, deprecation_collector_1.getDeprecations)();
if (deprecations.length === 0) {
@@ -142624,7 +142638,7 @@ function renderBuildResults(results) {
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build Scan®</th>
<th>Build&nbsp;Scan®</th>
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
</table>
`;
@@ -142644,16 +142658,35 @@ function renderOutcome(result) {
}
function renderBuildScan(result) {
if (result.buildScanFailed) {
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting');
return renderBuildScanBadge({
text: 'Publish failed',
alt: 'Build Scan publish failed',
color: 'orange',
logo: false,
targetUrl: 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
});
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
return renderBuildScanBadge({
text: 'Build Scan®',
alt: 'Build Scan published',
color: '06A0CE',
logo: true,
targetUrl: result.buildScanUri
});
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
return renderBuildScanBadge({
text: 'Not published',
alt: 'Build Scan not published',
color: 'lightgrey',
logo: false,
targetUrl: 'https://scans.gradle.com'
});
}
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
function renderBuildScanBadge({ text, alt, color, logo, targetUrl }) {
const encodedText = encodeURIComponent(text);
const badgeUrl = `https://img.shields.io/badge/${encodedText}-${color}${logo ? '?logo=Gradle' : ''}`;
const badgeHtml = `<img src="${badgeUrl}" alt="${alt}" />`;
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`;
}
function truncateString(str, maxLength) {

File diff suppressed because one or more lines are too long

View File

@@ -89925,6 +89925,9 @@ class DependencyGraphConfig {
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
getReportDirectory() {
return path_1.default.resolve(getWorkspaceDirectory(), 'dependency-graph-reports');
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
@@ -90291,6 +90294,9 @@ function handleMainActionError(error) {
}
else if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.setFailed(String(error));
@@ -90303,6 +90309,9 @@ exports.handleMainActionError = handleMainActionError;
function handlePostActionError(error) {
if (error instanceof JobFailure) {
core.setFailed(String(error));
if (error.stack) {
core.info(error.stack);
}
}
else {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`);

File diff suppressed because one or more lines are too long

View File

@@ -25,7 +25,9 @@ Simply add this as a new workflow file to your repository (eg `.github/workflows
```yaml
name: Dependency Submission
on: [ push ]
on:
push:
branches: [ 'main' ]
permissions:
contents: write
@@ -104,6 +106,11 @@ In some cases, the default action configuration will not be sufficient, and addi
See the [Action Metadata file](../dependency-submission/action.yml) for a more detailed description of each input parameter.
The `GitHub Dependency Graph Gradle Plugin` can be further
[configured via a number of environment variables](https://github.com/gradle/github-dependency-graph-gradle-plugin?#required-environment-variables).
These will be automatically set by the `dependency-submission` action, but you may override these values
by setting them explicitly in your workflow file.
# Resolving a dependency vulnerability
## Finding the source of a dependency vulnerability
@@ -292,7 +299,8 @@ Example of a pull request workflow that executes a build for a pull request and
```yaml
name: Dependency review for pull requests
on: [ pull_request ]
on:
pull_request:
permissions:
contents: write
@@ -327,7 +335,8 @@ Because of this restriction, we require 2 separate workflows in order to generat
```yaml
name: Generate and save dependency graph
on: [ pull_request ]
on:
pull_request:
permissions:
contents: read # 'write' permission is not available
@@ -381,7 +390,8 @@ Here's an example of a separate "Dependency Review" workflow that will wait for
```yaml
name: dependency-review
on: [ pull_request ]
on:
pull_request:
permissions:
contents: read

View File

@@ -28,7 +28,8 @@ The recommended way to execute any Gradle build is with the help of the [Gradle
```yaml
name: Run Gradle on every push
on: push
on:
push:
jobs:
gradle:
@@ -720,10 +721,10 @@ Here's a minimal example:
env:
DEVELOCITY_INJECTION_ENABLED: true
DEVELOCITY_URL: https://develocity.your-server.com
DEVELOCITY_PLUGIN_VERSION: 3.17
DEVELOCITY_PLUGIN_VERSION: 3.17.2
```
This configuration will automatically apply `v3.17` of the [Develocity Gradle plugin](https://docs.gradle.com/develocity/gradle-plugin/), and publish build scans to https://develocity.your-server.com.
This configuration will automatically apply `v3.17.2` of the [Develocity Gradle plugin](https://docs.gradle.com/develocity/gradle-plugin/), and publish build scans to https://develocity.your-server.com.
This example assumes that the `develocity.your-server.com` server allows anonymous publishing of build scans.
In the likely scenario that your Develocity server requires authentication, you will also need to configure an additional environment variable

View File

@@ -56,7 +56,10 @@ Here's a sample complete workflow you can add to your repositories:
**`.github/workflows/gradle-wrapper-validation.yml`**
```yaml
name: "Validate Gradle Wrapper"
on: [push, pull_request]
on:
push:
pull_request:
jobs:
validation:

View File

@@ -11,7 +11,8 @@ The recommended way to execute any Gradle build is with the help of the [Gradle
```yaml
name: Build
on: [ push ]
on:
push:
jobs:
build:

View File

@@ -6,7 +6,7 @@ export function setup(config: BuildScanConfig): void {
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions')
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17')
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17.2')
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '2.0')
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl())
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree())

View File

@@ -45,6 +45,10 @@ export class DependencyGraphConfig {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix())
}
getReportDirectory(): string {
return path.resolve(getWorkspaceDirectory(), 'dependency-graph-reports')
}
static constructJobCorrelator(workflow: string, jobId: string, matrixJson: string): string {
const matrixString = this.describeMatrix(matrixJson)
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`

View File

@@ -22,6 +22,7 @@ export async function setup(config: DependencyGraphConfig): Promise<void> {
}
// Download and submit early, for compatability with dependency review.
if (option === DependencyGraphOption.DownloadAndSubmit) {
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory())
await downloadAndSubmitDependencyGraphs(config)
return
}
@@ -34,10 +35,7 @@ export async function setup(config: DependencyGraphConfig): Promise<void> {
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref)
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext())
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', getWorkspaceDirectory())
maybeExportVariable(
'DEPENDENCY_GRAPH_REPORT_DIR',
path.resolve(getWorkspaceDirectory(), 'dependency-graph-reports')
)
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory())
// To clear the dependency graph, we generate an empty graph by excluding all projects and configurations
if (option === DependencyGraphOption.Clear) {
@@ -62,22 +60,22 @@ export async function complete(config: DependencyGraphConfig): Promise<void> {
return
case DependencyGraphOption.GenerateAndSubmit:
case DependencyGraphOption.Clear: // Submit the empty dependency graph
await submitDependencyGraphs(await findGeneratedDependencyGraphFiles())
await submitDependencyGraphs(await findDependencyGraphFiles())
return
case DependencyGraphOption.GenerateAndUpload:
await uploadDependencyGraphs(await findGeneratedDependencyGraphFiles(), config)
await uploadDependencyGraphs(await findDependencyGraphFiles(), config)
}
} catch (e) {
warnOrFail(config, option, e)
}
}
async function findGeneratedDependencyGraphFiles(): Promise<string[]> {
const workspaceDirectory = getWorkspaceDirectory()
return await findDependencyGraphFiles(workspaceDirectory)
}
async function uploadDependencyGraphs(dependencyGraphFiles: string[], config: DependencyGraphConfig): Promise<void> {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to upload.')
return
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload not supported in the ACT environment.')
core.info(`Would upload: ${dependencyGraphFiles.join(', ')}`)
@@ -111,6 +109,11 @@ async function downloadAndSubmitDependencyGraphs(config: DependencyGraphConfig):
}
async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<void> {
if (dependencyGraphFiles.length === 0) {
core.info('No dependency graph files found to submit.')
return
}
if (isRunningInActEnvironment()) {
core.info('Dependency graph submit not supported in the ACT environment.')
core.info(`Would submit: ${dependencyGraphFiles.join(', ')}`)
@@ -122,17 +125,16 @@ async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<v
await submitDependencyGraphFile(dependencyGraphFile)
} catch (error) {
if (error instanceof RequestError) {
throw new Error(translateErrorMessage(dependencyGraphFile, error))
} else {
throw error
error.message = translateErrorMessage(dependencyGraphFile, error)
}
throw error
}
}
}
function translateErrorMessage(jsonFile: string, error: RequestError): string {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile)
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${String(error)}`
const mainWarning = `Dependency submission failed for ${relativeJsonFile}.\n${error.message}`
if (error.message === 'Resource not accessible by integration') {
return `${mainWarning}
Please ensure that the 'contents: write' permission is available for the workflow job.
@@ -156,8 +158,6 @@ async function submitDependencyGraphFile(jsonFile: string): Promise<void> {
}
async function downloadDependencyGraphs(): Promise<string[]> {
const workspaceDirectory = getWorkspaceDirectory()
const findBy = github.context.payload.workflow_run
? {
token: getGithubToken(),
@@ -168,34 +168,37 @@ async function downloadDependencyGraphs(): Promise<string[]> {
: undefined
const artifactClient = new DefaultArtifactClient()
const downloadPath = path.resolve(workspaceDirectory, 'dependency-graph')
const dependencyGraphArtifacts = (
await artifactClient.listArtifacts({
latest: true,
findBy
})
).artifacts.filter(candidate => candidate.name.startsWith(DEPENDENCY_GRAPH_PREFIX))
).artifacts.filter(artifact => artifact.name.startsWith(DEPENDENCY_GRAPH_PREFIX))
for (const artifact of dependencyGraphArtifacts) {
const downloadedArtifact = await artifactClient.downloadArtifact(artifact.id, {
path: downloadPath,
findBy
})
core.info(`Downloading dependency-graph artifact ${artifact.name} to ${downloadedArtifact.downloadPath}`)
}
return findDependencyGraphFiles(downloadPath)
return findDependencyGraphFiles()
}
async function findDependencyGraphFiles(dir: string): Promise<string[]> {
const globber = await glob.create(`${dir}/dependency-graph-reports/*.json`)
async function findDependencyGraphFiles(): Promise<string[]> {
const globber = await glob.create(`${getReportDirectory()}/**/*.json`)
const allFiles = await globber.glob()
const unprocessedFiles = allFiles.filter(file => !isProcessed(file))
unprocessedFiles.forEach(markProcessed)
core.info(`Found dependency graph files: ${unprocessedFiles.join(', ')}`)
return unprocessedFiles
}
function getReportDirectory(): string {
return process.env.DEPENDENCY_GRAPH_REPORT_DIR!
}
function isProcessed(dependencyGraphFile: string): boolean {
const markerFile = `${dependencyGraphFile}.processed`
return fs.existsSync(markerFile)

View File

@@ -22,7 +22,10 @@ export function handleMainActionError(error: unknown): void {
}
}
} else if (error instanceof JobFailure) {
core.setFailed(String(error)) // No stack trace for JobFailure: these are known errors
core.setFailed(String(error))
if (error.stack) {
core.info(error.stack)
}
} else {
core.setFailed(String(error))
if (error instanceof Error && error.stack) {
@@ -34,6 +37,9 @@ export function handleMainActionError(error: unknown): void {
export function handlePostActionError(error: unknown): void {
if (error instanceof JobFailure) {
core.setFailed(String(error))
if (error.stack) {
core.info(error.stack)
}
} else {
core.warning(`Unhandled error in Gradle post-action - job will continue: ${error}`)
if (error instanceof Error && error.stack) {

View File

@@ -78,7 +78,7 @@ Note that this permission is never available for a workflow triggered from a rep
return mainWarning
}
function renderSummaryTable(results: BuildResult[]): string {
export function renderSummaryTable(results: BuildResult[]): string {
return `${renderDeprecations()}\n${renderBuildResults(results)}`
}
@@ -113,7 +113,7 @@ function renderBuildResults(results: BuildResult[]): string {
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build Scan®</th>
<th>Build&nbsp;Scan®</th>
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
</table>
`
@@ -134,23 +134,46 @@ function renderOutcome(result: BuildResult): string {
return result.buildFailed ? ':x:' : ':white_check_mark:'
}
function renderBuildScan(result: BuildResult): string {
if (result.buildScanFailed) {
return renderBuildScanBadge(
'PUBLISH_FAILED',
'orange',
'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
)
}
if (result.buildScanUri) {
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri)
}
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com')
interface BadgeSpec {
text: string
alt: string
color: string
logo: boolean
targetUrl: string
}
function renderBuildScanBadge(outcomeText: string, outcomeColor: string, targetUrl: string): string {
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`
function renderBuildScan(result: BuildResult): string {
if (result.buildScanFailed) {
return renderBuildScanBadge({
text: 'Publish failed',
alt: 'Build Scan publish failed',
color: 'orange',
logo: false,
targetUrl: 'https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting'
})
}
if (result.buildScanUri) {
return renderBuildScanBadge({
text: 'Build Scan®',
alt: 'Build Scan published',
color: '06A0CE',
logo: true,
targetUrl: result.buildScanUri
})
}
return renderBuildScanBadge({
text: 'Not published',
alt: 'Build Scan not published',
color: 'lightgrey',
logo: false,
targetUrl: 'https://scans.gradle.com'
})
}
function renderBuildScanBadge({text, alt, color, logo, targetUrl}: BadgeSpec): string {
const encodedText = encodeURIComponent(text)
const badgeUrl = `https://img.shields.io/badge/${encodedText}-${color}${logo ? '?logo=Gradle' : ''}`
const badgeHtml = `<img src="${badgeUrl}" alt="${alt}" />`
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`
}

View File

@@ -12,7 +12,7 @@ if (gradleVersion < GradleVersion.version("5.2") ||
if (getVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE') != "true") {
throw new GradleException("Dependency Graph is not supported for ${gradleVersion}. No dependency snapshot will be generated.")
}
println "::warning::Dependency Graph is not supported for ${gradleVersion}. No dependency snapshot will be generated."
logger.warn("::warning::Dependency Graph is not supported for ${gradleVersion}. No dependency snapshot will be generated.")
return
}
@@ -23,11 +23,11 @@ if (isTopLevelBuild) {
def reportFile = getUniqueReportFile(getVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR'))
if (reportFile == null) {
println "::warning::No dependency snapshot generated for step. Could not determine unique job correlator - specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step."
logger.warn("::warning::No dependency snapshot generated for step. Could not determine unique job correlator - specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step.")
return
}
println "Generating dependency graph into '${reportFile}'"
logger.lifecycle("Generating dependency graph into '${reportFile}'")
}
apply from: 'gradle-actions.github-dependency-graph-gradle-plugin-apply.groovy'

View File

@@ -1,6 +1,6 @@
plugins {
id "com.gradle.develocity" version "3.17.1"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0"
id "com.gradle.develocity" version "3.17.2"
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.1"
}
develocity {

View File

@@ -16,8 +16,8 @@ import java.nio.file.Files
import java.util.zip.GZIPOutputStream
class BaseInitScriptTest extends Specification {
static final String DEVELOCITY_PLUGIN_VERSION = '3.17'
static final String CCUD_PLUGIN_VERSION = '2.0'
static final String DEVELOCITY_PLUGIN_VERSION = '3.17.2'
static final String CCUD_PLUGIN_VERSION = '2.0.1'
static final TestGradleVersion GRADLE_3_X = new TestGradleVersion(GradleVersion.version('3.5.1'), 7, 9)
static final TestGradleVersion GRADLE_4_X = new TestGradleVersion(GradleVersion.version('4.10.3'), 7, 10)

View File

@@ -190,7 +190,7 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
when:
settingsFile.text = """
plugins {
id 'com.gradle.develocity' version '3.17' apply(false)
id 'com.gradle.develocity' version '3.17.2' apply(false)
}
gradle.settingsEvaluated {
apply plugin: 'com.gradle.develocity'

View File

@@ -0,0 +1,177 @@
import { BuildResult } from '../../src/build-results'
import { renderSummaryTable } from '../../src/job-summary'
import dedent from 'dedent'
const successfulHelpBuild: BuildResult = {
rootProjectName: 'root',
rootProjectDir: '/',
requestedTasks: 'help',
gradleVersion: '8.0',
gradleHomeDir: '/opt/gradle',
buildFailed: false,
buildScanUri: 'https://scans.gradle.com/s/abc123',
buildScanFailed: false
}
const failedHelpBuild: BuildResult = {
...successfulHelpBuild,
buildFailed: true
}
const longArgsBuild: BuildResult = {
...successfulHelpBuild,
requestedTasks: 'check publishMyLongNamePluginPublicationToMavenCentral publishMyLongNamePluginPublicationToPluginPortal',
}
const scanPublishDisabledBuild: BuildResult = {
...successfulHelpBuild,
buildScanUri: '',
buildScanFailed: false,
}
const scanPublishFailedBuild: BuildResult = {
...successfulHelpBuild,
buildScanUri: '',
buildScanFailed: true,
}
describe('renderSummaryTable', () => {
describe('renders', () => {
it('successful build', () => {
const table = renderSummaryTable([successfulHelpBuild])
expect(table.trim()).toBe(dedent`
<table>
<tr>
<th>Gradle Root Project</th>
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build&nbsp;Scan®</th>
</tr>
<tr>
<td>root</td>
<td>help</td>
<td align='center'>8.0</td>
<td align='center'>:white_check_mark:</td>
<td><a href="https://scans.gradle.com/s/abc123" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-06A0CE?logo=Gradle" alt="Build Scan published" /></a></td>
</tr>
</table>
`);
})
it('failed build', () => {
const table = renderSummaryTable([failedHelpBuild])
expect(table.trim()).toBe(dedent`
<table>
<tr>
<th>Gradle Root Project</th>
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build&nbsp;Scan®</th>
</tr>
<tr>
<td>root</td>
<td>help</td>
<td align='center'>8.0</td>
<td align='center'>:x:</td>
<td><a href="https://scans.gradle.com/s/abc123" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-06A0CE?logo=Gradle" alt="Build Scan published" /></a></td>
</tr>
</table>
`);
})
describe('when build scan', () => {
it('publishing disabled', () => {
const table = renderSummaryTable([scanPublishDisabledBuild])
expect(table.trim()).toBe(dedent`
<table>
<tr>
<th>Gradle Root Project</th>
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build&nbsp;Scan®</th>
</tr>
<tr>
<td>root</td>
<td>help</td>
<td align='center'>8.0</td>
<td align='center'>:white_check_mark:</td>
<td><a href="https://scans.gradle.com" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Not%20published-lightgrey" alt="Build Scan not published" /></a></td>
</tr>
</table>
`);
})
it('publishing failed', () => {
const table = renderSummaryTable([scanPublishFailedBuild])
expect(table.trim()).toBe(dedent`
<table>
<tr>
<th>Gradle Root Project</th>
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build&nbsp;Scan®</th>
</tr>
<tr>
<td>root</td>
<td>help</td>
<td align='center'>8.0</td>
<td align='center'>:white_check_mark:</td>
<td><a href="https://docs.gradle.com/develocity/gradle-plugin/#troubleshooting" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Publish%20failed-orange" alt="Build Scan publish failed" /></a></td>
</tr>
</table>
`);
})
})
it('multiple builds', () => {
const table = renderSummaryTable([successfulHelpBuild, failedHelpBuild])
expect(table.trim()).toBe(dedent`
<table>
<tr>
<th>Gradle Root Project</th>
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build&nbsp;Scan®</th>
</tr>
<tr>
<td>root</td>
<td>help</td>
<td align='center'>8.0</td>
<td align='center'>:white_check_mark:</td>
<td><a href="https://scans.gradle.com/s/abc123" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-06A0CE?logo=Gradle" alt="Build Scan published" /></a></td>
</tr>
<tr>
<td>root</td>
<td>help</td>
<td align='center'>8.0</td>
<td align='center'>:x:</td>
<td><a href="https://scans.gradle.com/s/abc123" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-06A0CE?logo=Gradle" alt="Build Scan published" /></a></td>
</tr>
</table>
`);
})
it('truncating long requested tasks', () => {
const table = renderSummaryTable([longArgsBuild])
expect(table.trim()).toBe(dedent`
<table>
<tr>
<th>Gradle Root Project</th>
<th>Requested Tasks</th>
<th>Gradle Version</th>
<th>Build Outcome</th>
<th>Build&nbsp;Scan®</th>
</tr>
<tr>
<td>root</td>
<td><div title='check publishMyLongNamePluginPublicationToMavenCentral publishMyLongNamePluginPublicationToPluginPortal'>check publishMyLongNamePluginPublicationToMavenCentral publ…</div></td>
<td align='center'>8.0</td>
<td align='center'>:white_check_mark:</td>
<td><a href="https://scans.gradle.com/s/abc123" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-06A0CE?logo=Gradle" alt="Build Scan published" /></a></td>
</tr>
</table>
`);
})
})
})

View File

@@ -8,7 +8,10 @@ The action should be run in the root of the repository, as it will recursively s
```yaml
name: "Validate Gradle Wrapper"
on: [push, pull_request]
on:
push:
pull_request:
jobs:
validation: