Skip to content

Commit 0ab6a8a

Browse files
authored
Separate Sonar checks
1 parent 8113d30 commit 0ab6a8a

1 file changed

Lines changed: 42 additions & 8 deletions

File tree

.github/workflows/gradle-build.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
outputs:
3131
build-changes: ${{ steps.filter.outputs.build }}
32+
source-changes: ${{ steps.filter.outputs.java }}
3233
steps:
3334
- uses: actions/checkout@v5
3435
with:
@@ -42,13 +43,50 @@ jobs:
4243
- '**/*.gradle.kts'
4344
- '**/gradle-build.yml'
4445
- 'gradle.properties'
46+
java:
4547
- '**/*.java'
46-
48+
4749
gradle-build:
4850
name: Build project with Gradle
4951
needs: check-changes
5052
if: ${{ needs.check-changes.outputs.build-changes == 'true' }}
5153
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v5
56+
with:
57+
fetch-depth: 0
58+
- name: Set up JDK
59+
uses: actions/setup-java@v5
60+
with:
61+
java-version: '21'
62+
distribution: 'temurin'
63+
cache: 'gradle'
64+
- name: Setup Gradle
65+
uses: gradle/actions/setup-gradle@v4
66+
with:
67+
add-job-summary-as-pr-comment: on-failure
68+
build-scan-publish: true
69+
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
70+
build-scan-terms-of-use-agree: "yes"
71+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
72+
- name: Setup Testcontainers Cloud Client
73+
uses: atomicjar/testcontainers-cloud-setup-action@v1
74+
with:
75+
token: ${{ secrets.TC_CLOUD_TOKEN }}
76+
- name: Run CI build
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
run: ./gradlew check --configuration-cache
80+
- name: Terminate Testcontainers Cloud Client active sessions
81+
uses: atomicjar/testcontainers-cloud-setup-action@v1
82+
with:
83+
action: terminate
84+
85+
code-quality:
86+
name: Code Quality with Sonar
87+
needs: check-changes
88+
if: ${{ needs.check-changes.outputs.source-changes == 'true' }}
89+
runs-on: ubuntu-latest
5290
steps:
5391
- uses: actions/checkout@v5
5492
with:
@@ -76,16 +114,12 @@ jobs:
76114
- name: Setup Testcontainers Cloud Client
77115
uses: atomicjar/testcontainers-cloud-setup-action@v1
78116
with:
79-
token: ${{ secrets.TC_CLOUD_TOKEN }}
80-
- name: Run CI build
81-
env:
82-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83-
run: ./gradlew check --configuration-cache
117+
token: ${{ secrets.TC_CLOUD_TOKEN }}
84118
- name: Publish Sonar report
85119
env:
86120
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
87-
run: ./gradlew sonar
121+
run: ./gradlew check sonar
88122
- name: Terminate Testcontainers Cloud Client active sessions
89123
uses: atomicjar/testcontainers-cloud-setup-action@v1
90124
with:
91-
action: terminate
125+
action: terminate

0 commit comments

Comments
 (0)