mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 17:12:51 +00:00
Update Build Scan™ to Build Scan®
This commit is contained in:
parent
0904709a46
commit
ced6859e9c
13 changed files with 3694 additions and 1766 deletions
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:
|
||||||
|
|
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')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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,7 +404,7 @@ 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.
|
||||||
|
|
|
@ -87,7 +87,7 @@ inputs:
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
build-scan-url:
|
build-scan-url:
|
||||||
description: Link to the build scan if any
|
description: Link to the Build Scan® if any
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
|
|
2706
dist/main/index.js
vendored
2706
dist/main/index.js
vendored
File diff suppressed because it is too large
Load diff
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
2706
dist/post/index.js
vendored
2706
dist/post/index.js
vendored
File diff suppressed because it is too large
Load diff
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
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue