Skip to content

Commit a77b498

Browse files
committed
chore: add configuration + workflow for sonarqube
1 parent 458cb61 commit a77b498

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: SonarQube
2+
on:
3+
push:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
jobs:
7+
build:
8+
name: Build and analyze
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v4
16+
with:
17+
java-version: 17
18+
distribution: 'zulu' # Alternative distribution options are available
19+
- name: Cache SonarQube packages
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.sonar/cache
23+
key: ${{ runner.os }}-sonar
24+
restore-keys: ${{ runner.os }}-sonar
25+
- name: Cache Gradle packages
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.gradle/caches
29+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
30+
restore-keys: ${{ runner.os }}-gradle
31+
- name: Build and analyze
32+
env:
33+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
34+
run: ./gradlew build sonar --info

build.gradle

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
plugins {
2626
id 'java'
2727
id 'jacoco'
28+
id 'org.sonarqube' version '6.2.0.5505'
2829
}
2930

30-
group = 'com.interguess'
31-
version = 'unknown'
31+
group 'com.interguess'
32+
version 'unknown'
3233

3334
java {
3435
toolchain {
@@ -40,6 +41,14 @@ jacoco {
4041
toolVersion = '0.8.12'
4142
}
4243

44+
sonar {
45+
properties {
46+
property "sonar.projectKey", "Interguess_auto-impl"
47+
property "sonar.organization", "interguess"
48+
property "sonar.host.url", "https://sonarcloud.io"
49+
}
50+
}
51+
4352
repositories {
4453
mavenCentral()
4554
}

0 commit comments

Comments
 (0)