mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-26 00:32:08 -05:00
Remove use of deprecated 'set-output' command
- Use GITHUB_OUTPUT file in init script - Write to a marker file in configuratiion-cache tests Fixes #461
This commit is contained in:
parent
c267ad1fcb
commit
3b959539de
4 changed files with 16 additions and 9 deletions
|
@ -11,8 +11,8 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("test").configure {
|
tasks.named("test").configure {
|
||||||
// Echo an output value so we can detect configuration-cache usage
|
// Write marker file so we can detect if task was configured
|
||||||
println "::set-output name=task_configured::yes"
|
file("task-configured.txt").text = "true"
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
if (System.properties.verifyCachedBuild) {
|
if (System.properties.verifyCachedBuild) {
|
||||||
|
|
|
@ -18,8 +18,8 @@ tasks.test {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("test").configure {
|
tasks.named("test").configure {
|
||||||
// Echo an output value so we can detect configuration-cache usage
|
// Write marker file so we can detect if task was configured
|
||||||
println("::set-output name=task_configured::yes")
|
file("task-configured.txt").writeText("true")
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
if (System.getProperties().containsKey("verifyCachedBuild")) {
|
if (System.getProperties().containsKey("verifyCachedBuild")) {
|
||||||
|
|
|
@ -60,11 +60,13 @@ jobs:
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: ./gradlew test --configuration-cache
|
||||||
- name: Check that configuration-cache was used
|
- name: Check that configuration-cache was used
|
||||||
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
|
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
const fs = require('fs')
|
||||||
|
if (fs.existsSync('.github/workflow-samples/groovy-dsl/task-configured.txt')) {
|
||||||
|
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||||
|
}
|
||||||
|
|
||||||
# Check that the build can run when no extracted cache entries are restored
|
# Check that the build can run when no extracted cache entries are restored
|
||||||
gradle-user-home-not-fully-restored:
|
gradle-user-home-not-fully-restored:
|
||||||
|
@ -154,9 +156,11 @@ jobs:
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: ./gradlew test --configuration-cache
|
||||||
- name: Check that configuration-cache was used
|
- name: Check that configuration-cache was used
|
||||||
if: ${{ steps.execute.outputs.task_configured == 'yes' }}
|
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
const fs = require('fs')
|
||||||
|
if (fs.existsSync('.github/workflow-samples/kotlin-dsl/task-configured.txt')) {
|
||||||
|
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,10 @@ def captureUsingBuildScanPublished(buildScanExtension, rootProject, invocationId
|
||||||
buildResults.setBuildScanUri(buildScan.buildScanUri.toASCIIString())
|
buildResults.setBuildScanUri(buildScan.buildScanUri.toASCIIString())
|
||||||
buildResults.writeToResultsFile(true)
|
buildResults.writeToResultsFile(true)
|
||||||
|
|
||||||
println("::set-output name=build-scan-url::${buildScan.buildScanUri}")
|
def githubOutput = System.getenv("GITHUB_OUTPUT")
|
||||||
|
if (githubOutput) {
|
||||||
|
new File(githubOutput) << "build-scan-url=${buildScan.buildScanUri}\n"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onError { error ->
|
onError { error ->
|
||||||
|
|
Loading…
Reference in a new issue