Skip to content

Commit a214611

Browse files
SONARJAVA-5946 Use develocity in GHA build (#5386)
* Configure Develocity to fix errors in logs and speed up the build. * Split test-analyze, it is a long step, which can block the pipeline. * Remove wrong config-maven parameters, they apply to build-maven, not config-maven.
1 parent 244ad0c commit a214611

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1515
cancel-in-progress: true
1616

17+
env:
18+
USE_DEVELOCITY: true
19+
DEVELOCITY_URL: https://develocity-public.sonar.build/
20+
1721
jobs:
1822
build:
1923
runs-on: github-ubuntu-latest-m # Public repo uses custom GitHub-hosted runner
@@ -39,6 +43,8 @@ jobs:
3943
# Override artifactory roles for public repo using private access
4044
artifactory-reader-role: private-reader
4145
artifactory-deployer-role: qa-deployer
46+
use-develocity: ${{ env.USE_DEVELOCITY }}
47+
develocity-url: ${{ env.DEVELOCITY_URL }}
4248
maven-args: >
4349
--define maven.test.skip=true
4450
--define sonar.skip=true
@@ -77,6 +83,8 @@ jobs:
7783
uses: SonarSource/ci-github-actions/config-maven@v1
7884
with:
7985
artifactory-reader-role: private-reader
86+
use-develocity: ${{ env.USE_DEVELOCITY }}
87+
develocity-url: ${{ env.DEVELOCITY_URL }}
8088
- name: Getting Vault Secrets
8189
id: secrets
8290
uses: SonarSource/vault-action-wrapper@320bd31b03e5dacaac6be51bbbb15adf7caccc32 # v3.1.0
@@ -126,6 +134,8 @@ jobs:
126134
uses: SonarSource/ci-github-actions/config-maven@v1
127135
with:
128136
artifactory-reader-role: private-reader
137+
use-develocity: ${{ env.USE_DEVELOCITY }}
138+
develocity-url: ${{ env.DEVELOCITY_URL }}
129139
- name: Getting Vault Secrets
130140
id: secrets
131141
uses: SonarSource/vault-action-wrapper@320bd31b03e5dacaac6be51bbbb15adf7caccc32 # v3.1.0
@@ -170,9 +180,9 @@ jobs:
170180
mvn clean compile --batch-mode
171181
- uses: SonarSource/ci-github-actions/config-maven@v1
172182
with:
173-
deploy: false
174183
artifactory-reader-role: private-reader
175-
artifactory-deployer-role: qa-deployer
184+
use-develocity: ${{ env.USE_DEVELOCITY }}
185+
develocity-url: ${{ env.DEVELOCITY_URL }}
176186
- name: Sanity Test
177187
env:
178188
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
@@ -208,11 +218,45 @@ jobs:
208218
deploy: false
209219
artifactory-reader-role: private-reader # Override default public-reader
210220
artifactory-deployer-role: qa-deployer # Override default public-deployer
221+
use-develocity: ${{ env.USE_DEVELOCITY }}
222+
develocity-url: ${{ env.DEVELOCITY_URL }}
211223
scanner-java-opts: '-Xmx2g'
212224
env:
213225
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
214226
SONAR_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_TOKEN }}
215227
JAVA_TOOL_OPTIONS: "" # Set an empty value to avoid issues with runners hanging and significantly slowing down builds
228+
229+
custom-rules-license-check:
230+
name: Custom Rules and License Check
231+
needs:
232+
- build
233+
if: ${{ needs.build.outputs.deployed }}
234+
runs-on: github-ubuntu-latest-m
235+
permissions:
236+
id-token: write
237+
contents: write
238+
env:
239+
BUILD_NUMBER: ${{ needs.build.outputs.build-number }}
240+
steps:
241+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
242+
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
243+
with:
244+
version: 2025.7.12
245+
- uses: SonarSource/vault-action-wrapper@v3
246+
id: secrets
247+
with:
248+
secrets: |
249+
development/kv/data/next url | SONAR_HOST_URL;
250+
development/kv/data/next token | SONAR_TOKEN;
251+
- uses: SonarSource/ci-github-actions/config-maven@v1
252+
with:
253+
artifactory-reader-role: private-reader
254+
use-develocity: ${{ env.USE_DEVELOCITY }}
255+
develocity-url: ${{ env.DEVELOCITY_URL }}
256+
env:
257+
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
258+
SONAR_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_TOKEN }}
259+
JAVA_TOOL_OPTIONS: "" # Set an empty value to avoid issues with runners hanging and significantly slowing down builds
216260
- name: Build Java Custom Rules Example
217261
env:
218262
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
@@ -266,9 +310,9 @@ jobs:
266310
run: mise use java@17
267311
- uses: SonarSource/ci-github-actions/config-maven@v1
268312
with:
269-
deploy: false
270313
artifactory-reader-role: private-reader
271-
artifactory-deployer-role: qa-deployer
314+
use-develocity: ${{ env.USE_DEVELOCITY }}
315+
develocity-url: ${{ env.DEVELOCITY_URL }}
272316
- name: Run autoscan tests
273317
env:
274318
SONAR_HOST_URL: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_HOST_URL }}
@@ -297,6 +341,12 @@ jobs:
297341
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
298342
with:
299343
version: 2025.7.12
344+
- name: Configure Maven
345+
uses: SonarSource/ci-github-actions/config-maven@v1
346+
with:
347+
artifactory-reader-role: private-reader
348+
use-develocity: ${{ env.USE_DEVELOCITY }}
349+
develocity-url: ${{ env.DEVELOCITY_URL }}
300350
- name: Run Maven
301351
run: mvn clean verify --batch-mode
302352

@@ -307,6 +357,7 @@ jobs:
307357
- plugin-qa
308358
- sanity
309359
- test-analyze
360+
- custom-rules-license-check
310361
- autoscan
311362
- qa-os-win
312363
if: ${{ needs.build.outputs.deployed }}

.mvn/develocity.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<develocity>
22
<server>
3-
<url>https://develocity.sonar.build</url>
3+
<url>https://develocity-public.sonar.build</url>
44
</server>
55
<buildCache>
66
<local>

0 commit comments

Comments
 (0)