Skip to content

Commit d2ee878

Browse files
SONARJAVA-5812 Use config-gradle action in QA (#67)
1 parent c434fcc commit d2ee878

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,27 @@ jobs:
2323
id-token: write # Required for Vault OIDC authentication
2424
contents: write # Required for repository access and tagging
2525
outputs:
26-
build-number: ${{ steps.build-gradle.outputs.BUILD_NUMBER }}
26+
build-number: ${{ steps.build-step.outputs.BUILD_NUMBER }}
27+
deployed: ${{ steps.build-step.outputs.deployed }}
2728
steps:
2829
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2930
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
3031
with:
3132
version: 2025.7.12
3233
- uses: SonarSource/ci-github-actions/build-gradle@v1
33-
id: build-gradle
34+
id: build-step
3435
with:
3536
deploy-pull-request: true
3637
artifactory-reader-role: private-reader # Override for public repo using private access
3738
artifactory-deployer-role: qa-deployer # Override for public repo using private access
3839

3940
qa:
4041
needs: [build]
42+
if: ${{ needs.build.outputs.deployed }}
4143
runs-on: github-ubuntu-latest-s # Public repository runner
4244
permissions:
4345
id-token: write # Required for Vault OIDC authentication
44-
contents: write # Required for repository access
46+
contents: read # Required for repository access
4547
strategy:
4648
fail-fast: false
4749
matrix:
@@ -51,61 +53,54 @@ jobs:
5153
item:
5254
- { suite: "plugin", sq_version: "DEV", submodules: false}
5355
- { suite: "plugin", sq_version: "LATEST_RELEASE", submodules: false}
54-
- { suite: "ruling", sq_version: "LATEST_RELEASE", submodules: true}
56+
- { suite: "ruling", sq_version: "LATEST_RELEASE" }
5557
name: "QA Tests [${{ matrix.item.suite }}] - SQ : ${{ matrix.item.sq_version }}"
5658
steps:
5759
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5860
with:
59-
submodules: ${{ matrix.item.submodules }}
61+
submodules: ${{ matrix.item.suite == 'ruling' }}
6062
- name: Remove kotlin ITs as they are not relevant for ruling tests (and cause issues with wrapper validation)
61-
if: ${{ matrix.item.submodules }}
63+
if: ${{ matrix.item.suite == 'ruling' }}
6264
run: rm -r ./its/sources/kotlin
6365
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
6466
with:
65-
cache_save: false
6667
version: 2025.7.12
6768
- name: Get GitHub Token for QA Licenses
6869
id: secrets
6970
uses: SonarSource/vault-action-wrapper@v3
7071
with:
71-
# TODO Remove artifactory token when build-gradle provides it
7272
secrets: |
7373
development/github/token/licenses-ro token | GITHUB_TOKEN;
7474
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_ACCESS_TOKEN;
7575
- name: Configure Gradle
76-
uses: SonarSource/ci-github-actions/build-gradle@v1 # TODO When config-gradle is released, use it and remove the gradle-args below
76+
uses: SonarSource/ci-github-actions/build-gradle@v1
7777
with:
7878
gradle-args: "-x build -x sonar -x artifactoryPublish" # Skip everything to only configure Gradle and Artifactory access
79-
artifactory-reader-role: private-reader # Override for public repo using private access
80-
artifactory-deployer-role: qa-deployer # TODO Should not be needed for config-gradle
79+
artifactory-reader-role: private-reader
80+
artifactory-deployer-role: qa-deployer
8181
- name: Run QA Tests
8282
env:
8383
GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }}
8484
ARTIFACTORY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_ACCESS_TOKEN }}
8585
SUITE: ${{ matrix.item.suite }}
8686
SQ_VERSION: ${{ matrix.item.sq_version }}
87-
BUILD_NUMBER: ${{ needs.build.outputs.build-number }}
8887
run: |
8988
./gradlew ":its:${SUITE}:test" --project-prop ${SUITE} \
9089
"-Dsonar.runtimeVersion=${SQ_VERSION}" \
9190
"-Dorchestrator.artifactory.accessToken=${ARTIFACTORY_ACCESS_TOKEN}" \
9291
"-DbuildNumber=${BUILD_NUMBER}" \
9392
--info --stacktrace --console plain --no-daemon --build-cache
9493
promote:
94+
name: Promote
9595
needs:
9696
- build
9797
- qa
9898
runs-on: github-ubuntu-latest-s # Public repository runner
99-
name: Promote
99+
if: ${{ needs.build.outputs.deployed }}
100100
permissions:
101101
id-token: write # Required for Vault OIDC authentication
102102
contents: write # Required for repository access and tagging
103103
steps:
104-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
105-
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
106-
with:
107-
cache_save: false
108-
version: 2025.7.12
109104
- uses: SonarSource/ci-github-actions/promote@v1
110105
with:
111106
promote-pull-request: true # Enable PR artifact promotion

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ allprojects {
2929
ext {
3030
buildNumber = System.getProperty("buildNumber")
3131

32-
sonarLinksCi = 'https://cirrus-ci.com/github/SonarSource/sonar-scala'
32+
sonarLinksCi = 'https://github.com/SonarSource/sonar-scala/actions/workflows/build.yml'
3333
sonarLinksScm = 'https://github.com/SonarSource/sonar-scala'
3434

3535
artifactsToPublish = ''

0 commit comments

Comments
 (0)