Skip to content

Commit 0330d15

Browse files
authored
Merge pull request #58 from AltaPay/sonarqube-workflow
Sonarqube workflow
2 parents 4089c46 + beee999 commit 0330d15

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: SonarQube Analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
8+
jobs:
9+
build:
10+
name: Build and analyze
11+
runs-on: self-hosted
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: 17
21+
distribution: 'temurin'
22+
23+
- name: Build with Gradle
24+
run: ./gradlew clean build
25+
26+
- name: Run SonarQube analysis
27+
env:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
29+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
30+
run: ./gradlew sonar --no-daemon

build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
id "maven-publish"
66
id "signing"
77
id "org.jreleaser" version "1.20.0"
8+
id "org.sonarqube" version "6.0.1.5171"
89
}
910

1011
group = 'com.altapay'
@@ -69,6 +70,24 @@ tasks.register("integrationTest", Test) {
6970
useJUnitPlatform()
7071
}
7172

73+
sonar {
74+
properties {
75+
property "sonar.projectKey", "AltaPay_sdk-java_69a0e28c-3133-48fd-8372-6c73a9cba728"
76+
property "sonar.host.url", System.getenv("SONAR_HOST_URL") ?: System.getProperty("sonar.host.url")
77+
property "sonar.token", System.getenv("SONAR_TOKEN") ?: System.getProperty("sonar.token")
78+
79+
property "sonar.scm.disabled", "true"
80+
property "sonar.cpd.exclusions", "**/*"
81+
property "sonar.duplications.exclusions", "**/*"
82+
83+
property "sonar.coverage.exclusions", "**/*"
84+
property "sonar.java.coveragePlugin", "none"
85+
86+
// Fail build if Quality Gate fails
87+
property "sonar.qualitygate.wait", "true"
88+
}
89+
}
90+
7291
java {
7392
toolchain {
7493
languageVersion = JavaLanguageVersion.of(17)

0 commit comments

Comments
 (0)