mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-24 11:08:56 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4cf152f48 | ||
|
|
a8aac055e2 | ||
|
|
7241fa5d56 | ||
|
|
9e58f8b1de | ||
|
|
632e888003 | ||
|
|
ced6859e9c | ||
|
|
0904709a46 | ||
|
|
1b94073332 | ||
|
|
4821f54162 | ||
|
|
2dbad1ea2d |
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
@@ -22,12 +22,7 @@ updates:
|
|||||||
ignore:
|
ignore:
|
||||||
- dependency-name: "@types/node"
|
- dependency-name: "@types/node"
|
||||||
groups:
|
groups:
|
||||||
runtime-dependencies:
|
npm-dependencies:
|
||||||
patterns:
|
|
||||||
- "@actions/*"
|
|
||||||
- "@octokit/rest"
|
|
||||||
- "string-argv"
|
|
||||||
dev-dependencies:
|
|
||||||
patterns:
|
patterns:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.enterprise" version "3.13.4"
|
id "com.gradle.enterprise" version "3.14"
|
||||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11"
|
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.gradle.enterprise") version "3.13.4"
|
id("com.gradle.enterprise") version "3.14"
|
||||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.11"
|
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.11.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.build-scan" version "3.13.4"
|
id "com.gradle.build-scan" version "3.14"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.enterprise" version "3.13.4"
|
id "com.gradle.enterprise" version "3.14"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
2
.github/workflows/ci-init-script-check.yml
vendored
2
.github/workflows/ci-init-script-check.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 8
|
java-version: 8
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/gradle-build-action@v2.6.0 # Use a released version to avoid breakages
|
uses: gradle/gradle-build-action@v2.6.1 # Use a released version to avoid breakages
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
working-directory: test/init-scripts
|
working-directory: test/init-scripts
|
||||||
run: ./gradlew check
|
run: ./gradlew check
|
||||||
|
|||||||
4
.github/workflows/demo-job-summary.yml
vendored
4
.github/workflows/demo-job-summary.yml
vendored
@@ -23,10 +23,10 @@ jobs:
|
|||||||
- name: Build kotlin-dsl project
|
- name: Build kotlin-dsl project
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew assemble
|
run: ./gradlew assemble
|
||||||
- name: Build kotlin-dsl project without build scan
|
- name: Build kotlin-dsl project without Build Scan®
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew assemble check --no-scan
|
run: ./gradlew assemble check --no-scan
|
||||||
- name: Build kotlin-dsl project with build scan publish failure
|
- name: Build kotlin-dsl project with Build Scan® publish failure
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew check -Dgradle.enterprise.url=https://not.valid.server
|
run: ./gradlew check -Dgradle.enterprise.url=https://not.valid.server
|
||||||
- name: Build groovy-dsl project
|
- name: Build groovy-dsl project
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Demo adding build scan comment to PR
|
name: Demo adding Build Scan® comment to PR
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [assigned, review_requested]
|
types: [assigned, review_requested]
|
||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew build --scan
|
run: ./gradlew build --scan
|
||||||
- name: "Add build scan URL as PR comment"
|
- name: "Add Build Scan URL as PR comment"
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
|||||||
@@ -88,12 +88,12 @@ jobs:
|
|||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
- name: Check build scan url is captured
|
- name: Check Build Scan url is captured
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
|
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
|
||||||
cache-disabled-pre-existing-gradle-home:
|
cache-disabled-pre-existing-gradle-home:
|
||||||
@@ -111,12 +111,12 @@ jobs:
|
|||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
- name: Check build scan url is captured
|
- name: Check Build Scan url is captured
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
# Test seed the cache with cache-write-only and verify with cache-read-only
|
# Test seed the cache with cache-write-only and verify with cache-read-only
|
||||||
seed-build-write-only:
|
seed-build-write-only:
|
||||||
|
|||||||
@@ -78,20 +78,18 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
dependency-graph: generate
|
dependency-graph: generate
|
||||||
- name: Run assemble
|
- id: gradle-assemble
|
||||||
run: ./gradlew assemble
|
run: ./gradlew assemble
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
env:
|
- id: gradle-build
|
||||||
GITHUB_JOB_CORRELATOR: job-correlator
|
|
||||||
- name: Run build
|
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
env:
|
|
||||||
GITHUB_JOB_CORRELATOR: job-correlator
|
|
||||||
- name: Check generated dependency graphs
|
- name: Check generated dependency graphs
|
||||||
run: |
|
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 }}"
|
||||||
ls -l dependency-graph-reports
|
ls -l dependency-graph-reports
|
||||||
if ([ ! -e dependency-graph-reports/job-correlator.json ] || [ ! -e dependency-graph-reports/job-correlator-1.json ])
|
if ([ ! -e ${{ steps.gradle-assemble.outputs.dependency-graph-file }} ] || [ ! -e ${{ steps.gradle-build.outputs.dependency-graph-file }} ])
|
||||||
then
|
then
|
||||||
echo "Did not find expected dependency graph files"
|
echo "Did not find expected dependency graph files"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
4
.github/workflows/integ-test-execution.yml
vendored
4
.github/workflows/integ-test-execution.yml
vendored
@@ -84,11 +84,11 @@ jobs:
|
|||||||
gradle-version: ${{matrix.gradle}}
|
gradle-version: ${{matrix.gradle}}
|
||||||
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
arguments: help -DgradleVersionCheck=${{matrix.gradle}}
|
arguments: help -DgradleVersionCheck=${{matrix.gradle}}
|
||||||
- name: Check build scan url
|
- name: Check Build Scan url
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -88,11 +88,11 @@ jobs:
|
|||||||
id: gradle
|
id: gradle
|
||||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||||
- name: Check build scan url
|
- name: Check Build Scan url
|
||||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('No build scan detected')
|
core.setFailed('No Build Scan detected')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
57
README.md
57
README.md
@@ -41,7 +41,7 @@ However, the `gradle-build-action` offers a number of advantages over this appro
|
|||||||
- Easily [run the build with different versions of Gradle](#use-a-specific-gradle-version) using the `gradle-version` parameter. Gradle distributions are automatically downloaded and cached.
|
- Easily [run the build with different versions of Gradle](#use-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).
|
- 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).
|
||||||
- Detailed reporting of cache usage and cache configuration options allow you to [optimize the use of the GitHub actions cache](#optimizing-cache-effectiveness).
|
- Detailed reporting of cache usage and cache configuration options allow you to [optimize the use of the GitHub actions cache](#optimizing-cache-effectiveness).
|
||||||
- [Automatic capture of build scan links](#build-scans) from the build, making these easier to locate for workflow run.
|
- [Automatic capture of Build Scan® links](#build-scans) from the build, making these easier to locate for workflow run.
|
||||||
|
|
||||||
The `gradle-build-action` is designed to provide these benefits with minimal configuration.
|
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.
|
These features work both when Gradle is executed via the `gradle-build-action` and for any Gradle execution in subsequent steps.
|
||||||
@@ -339,7 +339,7 @@ If you are using init scripts for the [Gradle Enterprise Gradle Plugin](https://
|
|||||||
you'll need to ensure these files are applied prior to `build-result-capture.init.gradle`.
|
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.
|
Since Gradle applies init scripts in alphabetical order, one way to ensure this is via file naming.
|
||||||
|
|
||||||
### Build scan link as Step output
|
### Build Scan® link as Step output
|
||||||
|
|
||||||
As well as reporting the [Build Scan](https://gradle.com/build-scans/) link in the Job Summary,
|
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`.
|
the `gradle-build-action` action makes this link available as a Step output named `build-scan-url`.
|
||||||
@@ -361,7 +361,7 @@ jobs:
|
|||||||
- name: Run build with Gradle wrapper
|
- name: Run build with Gradle wrapper
|
||||||
id: gradle
|
id: gradle
|
||||||
run: ./gradlew build --scan
|
run: ./gradlew build --scan
|
||||||
- name: "Add build scan URL as PR comment"
|
- name: "Add Build Scan URL as PR comment"
|
||||||
uses: actions/github-script@v5
|
uses: actions/github-script@v5
|
||||||
if: github.event_name == 'pull_request' && failure()
|
if: github.event_name == 'pull_request' && failure()
|
||||||
with:
|
with:
|
||||||
@@ -404,13 +404,12 @@ jobs:
|
|||||||
## Support for GitHub Enterprise Server (GHES)
|
## 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:
|
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
|
- Build Scan links are captured and displayed in the GitHub Actions UI
|
||||||
- Easily run your build with different versions of Gradle
|
- 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)
|
- 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.
|
- 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
|
# GitHub Dependency Graph support
|
||||||
**EXPERIMENTAL**
|
|
||||||
|
|
||||||
The `gradle-build-action` has experimental 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 `gradle-build-action` has experimental 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).
|
||||||
|
|
||||||
@@ -449,13 +448,59 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Gradle to generate and submit dependency graphs
|
- name: Setup Gradle to generate and submit dependency graphs
|
||||||
uses: gradle/gradle-build-action@dependency-graph
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
dependency-graph: generate-and-submit
|
dependency-graph: generate-and-submit
|
||||||
- name: Run a build, generating the dependency graph snapshot which will be submitted
|
- name: Run a build, generating the dependency graph snapshot which will be submitted
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Filtering which Gradle Configurations contribute to the dependency graph
|
||||||
|
|
||||||
|
If you do not want 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.
|
||||||
|
|
||||||
|
Example of a simple workflow that limits the dependency graph to `RuntimeClasspath` configuration:
|
||||||
|
```yaml
|
||||||
|
name: Submit dependency graph
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- 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 'RuntimeClasspath' configurations
|
||||||
|
run: ./gradlew build -DDEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS=RuntimeClasspath
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gradle version compatibility
|
||||||
|
|
||||||
|
The 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.
|
||||||
|
|
||||||
### Dependency snapshots generated for pull requests
|
### Dependency snapshots generated for pull requests
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ inputs:
|
|||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
build-scan-url:
|
build-scan-url:
|
||||||
description: Link to the build scan if any
|
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.
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
|
|||||||
6
dist/main/index.js
vendored
6
dist/main/index.js
vendored
@@ -73588,7 +73588,7 @@ function writeSummaryTable(results) {
|
|||||||
<th>Requested Tasks</th>
|
<th>Requested Tasks</th>
|
||||||
<th>Gradle Version</th>
|
<th>Gradle Version</th>
|
||||||
<th>Build Outcome</th>
|
<th>Build Outcome</th>
|
||||||
<th>Build Scan™</th>
|
<th>Build Scan®</th>
|
||||||
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||||
</table>
|
</table>
|
||||||
`);
|
`);
|
||||||
@@ -73616,7 +73616,7 @@ function renderBuildScan(result) {
|
|||||||
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
||||||
}
|
}
|
||||||
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
||||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
||||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
||||||
}
|
}
|
||||||
@@ -73624,7 +73624,7 @@ function logSummaryTable(results) {
|
|||||||
core.info('============================');
|
core.info('============================');
|
||||||
core.info('Gradle Builds');
|
core.info('Gradle Builds');
|
||||||
core.info('----------------------------');
|
core.info('----------------------------');
|
||||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan™');
|
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®');
|
||||||
core.info('----------------------------');
|
core.info('----------------------------');
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
|
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
|
||||||
|
|||||||
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/post/index.js
vendored
6
dist/post/index.js
vendored
@@ -73456,7 +73456,7 @@ function writeSummaryTable(results) {
|
|||||||
<th>Requested Tasks</th>
|
<th>Requested Tasks</th>
|
||||||
<th>Gradle Version</th>
|
<th>Gradle Version</th>
|
||||||
<th>Build Outcome</th>
|
<th>Build Outcome</th>
|
||||||
<th>Build Scan™</th>
|
<th>Build Scan®</th>
|
||||||
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||||
</table>
|
</table>
|
||||||
`);
|
`);
|
||||||
@@ -73484,7 +73484,7 @@ function renderBuildScan(result) {
|
|||||||
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
||||||
}
|
}
|
||||||
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
||||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
||||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
||||||
}
|
}
|
||||||
@@ -73492,7 +73492,7 @@ function logSummaryTable(results) {
|
|||||||
core.info('============================');
|
core.info('============================');
|
||||||
core.info('Gradle Builds');
|
core.info('Gradle Builds');
|
||||||
core.info('----------------------------');
|
core.info('----------------------------');
|
||||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan™');
|
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®');
|
||||||
core.info('----------------------------');
|
core.info('----------------------------');
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
|
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
|
||||||
|
|||||||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
803
package-lock.json
generated
803
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -42,14 +42,15 @@
|
|||||||
"string-argv": "0.3.2"
|
"string-argv": "0.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "16.11.21",
|
"@types/node": "16.18.38",
|
||||||
"@types/jest": "29.5.3",
|
"@types/jest": "29.5.3",
|
||||||
"@types/unzipper": "0.10.6",
|
"@types/unzipper": "0.10.6",
|
||||||
"@typescript-eslint/parser": "5.62.0",
|
"@typescript-eslint/parser": "6.1.0",
|
||||||
"@vercel/ncc": "0.36.1",
|
"@vercel/ncc": "0.36.1",
|
||||||
"eslint": "8.44.0",
|
"eslint": "8.45.0",
|
||||||
"eslint-plugin-github": "4.8.0",
|
"eslint-plugin-github": "4.9.2",
|
||||||
"eslint-plugin-jest": "27.2.2",
|
"eslint-plugin-jest": "27.2.3",
|
||||||
|
"eslint-plugin-prettier": "5.0.0",
|
||||||
"jest": "29.6.1",
|
"jest": "29.6.1",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"patch-package": "7.0.0",
|
"patch-package": "7.0.0",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function writeSummaryTable(results: BuildResult[]): void {
|
|||||||
<th>Requested Tasks</th>
|
<th>Requested Tasks</th>
|
||||||
<th>Gradle Version</th>
|
<th>Gradle Version</th>
|
||||||
<th>Build Outcome</th>
|
<th>Build Outcome</th>
|
||||||
<th>Build Scan™</th>
|
<th>Build Scan®</th>
|
||||||
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||||
</table>
|
</table>
|
||||||
`)
|
`)
|
||||||
@@ -72,7 +72,7 @@ function renderBuildScan(result: BuildResult): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderBuildScanBadge(outcomeText: string, outcomeColor: string, targetUrl: string): string {
|
function renderBuildScanBadge(outcomeText: string, outcomeColor: string, targetUrl: string): string {
|
||||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`
|
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`
|
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`
|
||||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`
|
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ function logSummaryTable(results: BuildResult[]): void {
|
|||||||
core.info('============================')
|
core.info('============================')
|
||||||
core.info('Gradle Builds')
|
core.info('Gradle Builds')
|
||||||
core.info('----------------------------')
|
core.info('----------------------------')
|
||||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan™')
|
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®')
|
||||||
core.info('----------------------------')
|
core.info('----------------------------')
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
core.info(
|
core.info(
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if (isTopLevelBuild) {
|
|||||||
captureUsingBuildFinished(gradle, invocationId)
|
captureUsingBuildFinished(gradle, invocationId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The `buildScanPublished` hook allows the capture of the build scan URI.
|
// The `buildScanPublished` hook allows the capture of the Build Scan URI.
|
||||||
// Results captured this way will overwrite any results from the other mechanism.
|
// Results captured this way will overwrite any results from the other mechanism.
|
||||||
settings.pluginManager.withPlugin("com.gradle.enterprise") {
|
settings.pluginManager.withPlugin("com.gradle.enterprise") {
|
||||||
captureUsingBuildScanPublished(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject, invocationId)
|
captureUsingBuildScanPublished(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject, invocationId)
|
||||||
@@ -34,7 +34,7 @@ if (isTopLevelBuild) {
|
|||||||
// By default, use 'buildFinished' to capture build results
|
// By default, use 'buildFinished' to capture build results
|
||||||
captureUsingBuildFinished(gradle, invocationId)
|
captureUsingBuildFinished(gradle, invocationId)
|
||||||
|
|
||||||
// The `buildScanPublished` hook allows the capture of the build scan URI.
|
// The `buildScanPublished` hook allows the capture of the Build Scan URI.
|
||||||
// Results captured this way will overwrite any results from 'buildFinished'.
|
// Results captured this way will overwrite any results from 'buildFinished'.
|
||||||
gradle.rootProject.pluginManager.withPlugin("com.gradle.build-scan") {
|
gradle.rootProject.pluginManager.withPlugin("com.gradle.build-scan") {
|
||||||
captureUsingBuildScanPublished(gradle.rootProject.extensions["buildScan"], gradle.rootProject, invocationId)
|
captureUsingBuildScanPublished(gradle.rootProject.extensions["buildScan"], gradle.rootProject, invocationId)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ buildscript {
|
|||||||
maven { url "https://plugins.gradle.org/m2/" }
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.gradle:github-dependency-graph-gradle-plugin:0.1.0"
|
classpath "org.gradle:github-dependency-graph-gradle-plugin:0.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: org.gradle.github.GitHubDependencyGraphPlugin
|
apply plugin: org.gradle.github.GitHubDependencyGraphPlugin
|
||||||
|
|||||||
@@ -15,14 +15,20 @@ if (GradleVersion.current().baseVersion < GradleVersion.version("5.0")) {
|
|||||||
// This is only required for top-level builds
|
// This is only required for top-level builds
|
||||||
def isTopLevelBuild = gradle.getParent() == null
|
def isTopLevelBuild = gradle.getParent() == null
|
||||||
if (isTopLevelBuild) {
|
if (isTopLevelBuild) {
|
||||||
def jobCorrelator = ensureUniqueJobCorrelator(System.env.GITHUB_JOB_CORRELATOR)
|
def reportFile = getUniqueReportFile(System.env.GITHUB_JOB_CORRELATOR)
|
||||||
|
|
||||||
if (jobCorrelator == null) {
|
if (reportFile == null) {
|
||||||
println "::warning::No dependency snapshot generated for step: report file for '${jobCorrelator}' created in earlier step. Each build invocation requires a unique job correlator: specify GITHUB_JOB_CORRELATOR var for this step."
|
println "::warning::No dependency snapshot generated for step. Could not determine unique job correlator - specify GITHUB_JOB_CORRELATOR var for this step."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
println "Generating dependency graph for '${jobCorrelator}'"
|
def githubOutput = System.getenv("GITHUB_OUTPUT")
|
||||||
|
if (githubOutput) {
|
||||||
|
new File(githubOutput) << "dependency-graph-file=${reportFile.absolutePath}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
println "Generating dependency graph into '${reportFile}'"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
||||||
@@ -33,10 +39,10 @@ apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
|||||||
* - If so, tries to find a unique value that does not yet have a corresponding report file.
|
* - If so, tries to find a unique value that does not yet have a corresponding report file.
|
||||||
* - When found, this value is set as a System property override.
|
* - When found, this value is set as a System property override.
|
||||||
*/
|
*/
|
||||||
String ensureUniqueJobCorrelator(String jobCorrelator) {
|
File getUniqueReportFile(String jobCorrelator) {
|
||||||
def reportDir = System.env.DEPENDENCY_GRAPH_REPORT_DIR
|
def reportDir = System.env.DEPENDENCY_GRAPH_REPORT_DIR
|
||||||
def reportFile = new File(reportDir, jobCorrelator + ".json")
|
def reportFile = new File(reportDir, jobCorrelator + ".json")
|
||||||
if (!reportFile.exists()) return jobCorrelator
|
if (!reportFile.exists()) return reportFile
|
||||||
|
|
||||||
// Try at most 100 suffixes
|
// Try at most 100 suffixes
|
||||||
for (int i = 1; i < 100; i++) {
|
for (int i = 1; i < 100; i++) {
|
||||||
@@ -44,7 +50,7 @@ String ensureUniqueJobCorrelator(String jobCorrelator) {
|
|||||||
def candidateFile = new File(reportDir, candidateCorrelator + ".json")
|
def candidateFile = new File(reportDir, candidateCorrelator + ".json")
|
||||||
if (!candidateFile.exists()) {
|
if (!candidateFile.exists()) {
|
||||||
System.properties['GITHUB_JOB_CORRELATOR'] = candidateCorrelator
|
System.properties['GITHUB_JOB_CORRELATOR'] = candidateCorrelator
|
||||||
return candidateCorrelator
|
return candidateFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.gradle.enterprise" version "3.13.4"
|
id "com.gradle.enterprise" version "3.14"
|
||||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11"
|
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class BaseInitScriptTest extends Specification {
|
|||||||
} else {
|
} else {
|
||||||
"""
|
"""
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gradle.enterprise' version '3.13.4'
|
id 'com.gradle.enterprise' version '3.14'
|
||||||
}
|
}
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
server = '$mockScansServer.address'
|
server = '$mockScansServer.address'
|
||||||
@@ -165,7 +165,7 @@ class BaseInitScriptTest extends Specification {
|
|||||||
} else if (gradleVersion < GradleVersion.version('6.0')) {
|
} else if (gradleVersion < GradleVersion.version('6.0')) {
|
||||||
"""
|
"""
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gradle.build-scan' version '3.13.4'
|
id 'com.gradle.build-scan' version '3.14'
|
||||||
}
|
}
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
server = '$mockScansServer.address'
|
server = '$mockScansServer.address'
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
|
|||||||
when:
|
when:
|
||||||
settingsFile.text = """
|
settingsFile.text = """
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gradle.enterprise' version '3.13.4' apply(false)
|
id 'com.gradle.enterprise' version '3.14' apply(false)
|
||||||
}
|
}
|
||||||
gradle.settingsEvaluated {
|
gradle.settingsEvaluated {
|
||||||
apply plugin: 'com.gradle.enterprise'
|
apply plugin: 'com.gradle.enterprise'
|
||||||
|
|||||||
@@ -29,9 +29,10 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
|||||||
|
|
||||||
then:
|
then:
|
||||||
assert reportFile.exists()
|
assert reportFile.exists()
|
||||||
|
assert gitHubOutputFile.text == "dependency-graph-file=${reportFile.absolutePath}\n"
|
||||||
|
|
||||||
where:
|
where:
|
||||||
testGradleVersion << DEPENDENCY_GRAPH_VERSIONS
|
testGradleVersion << GRADLE_8_X
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dependency-graph plugin doesn't support config-cache for 8.0 of Gradle
|
// Dependency-graph plugin doesn't support config-cache for 8.0 of Gradle
|
||||||
@@ -114,7 +115,8 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
|||||||
GITHUB_REF: "main",
|
GITHUB_REF: "main",
|
||||||
GITHUB_SHA: "123456",
|
GITHUB_SHA: "123456",
|
||||||
GITHUB_WORKSPACE: testProjectDir.absolutePath,
|
GITHUB_WORKSPACE: testProjectDir.absolutePath,
|
||||||
DEPENDENCY_GRAPH_REPORT_DIR: reportsDir.absolutePath
|
DEPENDENCY_GRAPH_REPORT_DIR: reportsDir.absolutePath,
|
||||||
|
GITHUB_OUTPUT: gitHubOutputFile.absolutePath
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,4 +127,8 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
|||||||
def getReportFile() {
|
def getReportFile() {
|
||||||
return new File(reportsDir, "CORRELATOR.json")
|
return new File(reportsDir, "CORRELATOR.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getGitHubOutputFile() {
|
||||||
|
return new File(testProjectDir, "GITHUB_OUTPUT")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user