Skip to content

Commit 1250a70

Browse files
committed
Reuse gradle-build cache for Sonar
1 parent c08e6f1 commit 1250a70

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/gradle-build.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
needs: check-changes
5252
if: ${{ needs.check-changes.outputs.build-changes == 'true' }}
5353
runs-on: ubuntu-latest
54+
outputs:
55+
build-artifacts: ${{ steps.upload-build-artifacts.outputs.artifact-id }}
5456
steps:
5557
- uses: actions/checkout@v5
5658
with:
@@ -80,6 +82,12 @@ jobs:
8082
uses: atomicjar/testcontainers-cloud-setup-action@v1
8183
with:
8284
action: terminate
85+
- name: Upload build artifacts
86+
uses: actions/upload-artifact@v4
87+
id: upload-build-artifacts
88+
with:
89+
name: build-artifacts
90+
path: '**/build/classes'
8391

8492
code-quality:
8593
name: Code Quality with Sonar
@@ -104,7 +112,8 @@ jobs:
104112
build-scan-terms-of-use-agree: "yes"
105113
- name: Publish Sonar report
106114
env:
107-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
115+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
116+
SONAR_JAVA_BINARIES: ${{ needs.gradle-build.outputs.build-artifacts }}
108117
run: ./gradlew sonar
109118
- name: Terminate Testcontainers Cloud Client active sessions
110119
uses: atomicjar/testcontainers-cloud-setup-action@v1

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ sonar {
3434
property("sonar.projectKey", "rashidi_spring-boot-tutorials")
3535
property("sonar.organization", "rashidi-github")
3636
property("sonar.host.url", "https://sonarcloud.io")
37-
property("sonar.java.binaries", "**/build/classes")
3837
property("sonar.coverage.jacoco.xmlReportPaths", "${layout.buildDirectory.get()}/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml")
3938
}
4039
}

0 commit comments

Comments
 (0)