Skip to content

Commit da17525

Browse files
committed
set up SonarQube
1 parent 4491335 commit da17525

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
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
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

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
### Hexlet tests and linter status:
22
[![Actions Status](https://github.com/Prototype206/java-project-61/actions/workflows/hexlet-check.yml/badge.svg)](https://github.com/Prototype206/java-project-61/actions)
33

4+
### SonarQube
5+
6+
### PMD and Checkstyle
47
![PMD](https://img.shields.io/badge/PMD-enabled-brightgreen)
58
![Checkstyle](https://img.shields.io/badge/checkstyle-0_violations-success)
69
![Java CI](https://github.com/Prototype206/java-project-61/workflows/Quality%20Check/badge.svg)

app/build.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ plugins{
55
id("com.github.ben-manes.versions") version "0.53.0"
66
id("pmd")
77
id("checkstyle")
8+
id("org.sonarqube") version "7.1.0.6387"
89

910
}
10-
11+
sonar {
12+
properties {
13+
property("sonar.projectKey", "Prototype206_java-project-61")
14+
property("sonar.organization", "prototypes-organization")
15+
}
16+
}
1117

1218
pmd{
1319
toolVersion = "7.18.0"

0 commit comments

Comments
 (0)