diff --git a/.github/workflows/integ-test-dependency-graph.yml b/.github/workflows/integ-test-dependency-graph.yml index bd16441..bcd21e2 100644 --- a/.github/workflows/integ-test-dependency-graph.yml +++ b/.github/workflows/integ-test-dependency-graph.yml @@ -90,11 +90,15 @@ jobs: - id: gradle-build run: ./gradlew build working-directory: .github/workflow-samples/groovy-dsl + - id: gradle-build-again + run: ./gradlew build + working-directory: .github/workflow-samples/groovy-dsl - name: Check generated dependency graphs shell: bash run: | echo "gradle-assemble report file: ${{ steps.gradle-assemble.outputs.dependency-graph-file }}" echo "gradle-build report file: ${{ steps.gradle-build.outputs.dependency-graph-file }}" + echo "gradle-build-again report file: ${{ steps.gradle-build-again.outputs.dependency-graph-file }}" ls -l dependency-graph-reports if [ ! -e "${{ steps.gradle-assemble.outputs.dependency-graph-file }}" ]; then echo "Did not find gradle-assemble dependency graph file" @@ -104,3 +108,41 @@ jobs: echo "Did not find gradle-build dependency graph files" exit 1 fi + if [ ! -e "${{ steps.gradle-build-again.outputs.dependency-graph-file }}" ]; then + echo "Did not find gradle-build-again dependency graph files" + exit 1 + fi + + config-cache: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Download distribution if required + uses: ./.github/actions/download-dist + - name: Setup Gradle for dependency-graph generate + uses: ./ + with: + dependency-graph: generate-and-submit + - id: config-cache-store + run: ./gradlew assemble --configuration-cache + working-directory: .github/workflow-samples/groovy-dsl + - name: Check and delete generated dependency graph + shell: bash + run: | + if [ ! -e "${{ steps.config-cache-store.outputs.dependency-graph-file }}" ]; then + echo "Did not find config-cache-store dependency graph files" + exit 1 + fi + rm ${{ steps.config-cache-store.outputs.dependency-graph-file }} + - id: config-cache-reuse + run: ./gradlew assemble --configuration-cache + working-directory: .github/workflow-samples/groovy-dsl + - name: Check no dependency graph is generated + shell: bash + run: | + if [ ! -z "$(ls -A dependency-graph-reports)" ]; then + echo "Expected no dependency graph files to be generated" + ls -l dependency-graph-reports + exit 1 + fi diff --git a/src/resources/init-scripts/gradle-build-action.github-dependency-graph-gradle-plugin-apply.groovy b/src/resources/init-scripts/gradle-build-action.github-dependency-graph-gradle-plugin-apply.groovy index 5375ced..cd50cf1 100644 --- a/src/resources/init-scripts/gradle-build-action.github-dependency-graph-gradle-plugin-apply.groovy +++ b/src/resources/init-scripts/gradle-build-action.github-dependency-graph-gradle-plugin-apply.groovy @@ -9,7 +9,7 @@ buildscript { maven { url pluginRepositoryUrl } } dependencies { - classpath "org.gradle:github-dependency-graph-gradle-plugin:1.0.0" + classpath "org.gradle:github-dependency-graph-gradle-plugin:1.1.0" } } apply plugin: org.gradle.github.GitHubDependencyGraphPlugin diff --git a/src/resources/init-scripts/gradle-build-action.github-dependency-graph.init.gradle b/src/resources/init-scripts/gradle-build-action.github-dependency-graph.init.gradle index 2abdac7..56fd262 100644 --- a/src/resources/init-scripts/gradle-build-action.github-dependency-graph.init.gradle +++ b/src/resources/init-scripts/gradle-build-action.github-dependency-graph.init.gradle @@ -22,11 +22,6 @@ if (isTopLevelBuild) { return } - def githubOutput = System.getenv("GITHUB_OUTPUT") - if (githubOutput) { - new File(githubOutput) << "dependency-graph-file=${reportFile.absolutePath}\n" - } - println "Generating dependency graph into '${reportFile}'" } diff --git a/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy b/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy index 5d76807..e823b84 100644 --- a/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy +++ b/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy @@ -29,7 +29,6 @@ class TestDependencyGraph extends BaseInitScriptTest { then: assert reportFile.exists() - assert gitHubOutputFile.text == "dependency-graph-file=${reportFile.absolutePath}\n" where: testGradleVersion << [GRADLE_8_X] @@ -116,7 +115,6 @@ class TestDependencyGraph extends BaseInitScriptTest { GITHUB_DEPENDENCY_GRAPH_SHA: "123456", GITHUB_DEPENDENCY_GRAPH_WORKSPACE: testProjectDir.absolutePath, DEPENDENCY_GRAPH_REPORT_DIR: reportsDir.absolutePath, - GITHUB_OUTPUT: gitHubOutputFile.absolutePath ] } @@ -127,8 +125,4 @@ class TestDependencyGraph extends BaseInitScriptTest { def getReportFile() { return new File(reportsDir, "CORRELATOR.json") } - - def getGitHubOutputFile() { - return new File(testProjectDir, "GITHUB_OUTPUT") - } }