Skip to content

Commit e8b3595

Browse files
committed
SonarQube Cloud integration
1 parent 0ad7f8d commit e8b3595

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.github/workflows/build.yml

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

backend/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java'
33
id 'org.springframework.boot' version '3.4.4'
44
id 'io.spring.dependency-management' version '1.1.7'
5+
id "org.sonarqube" version "6.0.1.5171"
56
}
67

78
group = 'com.cilantro'
@@ -47,3 +48,11 @@ dependencies {
4748
tasks.named('test') {
4849
useJUnitPlatform()
4950
}
51+
52+
sonar {
53+
properties {
54+
property "sonar.projectKey", "blueheron786_jee-react-vite-site-quickstart"
55+
property "sonar.organization", "blueheron786"
56+
property "sonar.host.url", "https://sonarcloud.io"
57+
}
58+
}

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=blueheron786_jee-react-vite-site-quickstart
2+
sonar.organization=blueheron786
3+
4+
5+
# This is the name and version displayed in the SonarCloud UI.
6+
#sonar.projectName=jee-react-vite-site-quickstart
7+
#sonar.projectVersion=1.0
8+
9+
10+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
11+
#sonar.sources=.
12+
13+
# Encoding of the source code. Default is default system encoding
14+
#sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)