File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 16
16
steps :
17
17
- name : checkout
18
18
uses : actions/checkout@v2
19
+ with :
20
+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis for Sonarqube
19
21
20
22
# https://github.com/rlespinasse/github-slug-action
21
23
- name : Inject slug/short variables
@@ -58,10 +60,20 @@ jobs:
58
60
path : ~/.gradle/caches
59
61
key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
60
62
63
+ - name : Cache SonarCloud packages
64
+ uses : actions/cache@v1
65
+ with :
66
+ path : ~/.sonar/cache
67
+ key : ${{ runner.os }}-sonar
68
+ restore-keys : ${{ runner.os }}-sonar
69
+
61
70
- name : Grant execute permission for gradlew
62
71
run : chmod +x gradlew
63
72
- name : Build with Gradle
64
- run : ./gradlew build --no-daemon
73
+ env :
74
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
75
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
76
+ run : ./gradlew build sonarqube --no-daemon --info
65
77
66
78
- name : Login to GitHub Container Registry
67
79
uses : docker/login-action@v1
Original file line number Diff line number Diff line change 1
1
// {{start:build}}
2
- buildscript {
3
- repositories {
4
- jcenter()
5
- }
6
- // buildscript dependencies can be used for build time plugins.
7
- dependencies {
8
-
9
- }
2
+ plugins {
3
+ id " org.sonarqube" version " 3.3"
10
4
}
11
5
12
6
// Include a gradle script that has all of our dependencies split out.
@@ -84,6 +78,14 @@ allprojects {
84
78
}
85
79
}
86
80
}
81
+
82
+ sonarqube {
83
+ properties {
84
+ property " sonar.projectKey" , " StubbornJava_StubbornJava"
85
+ property " sonar.organization" , " stubbornjava"
86
+ property " sonar.host.url" , " https://sonarcloud.io"
87
+ }
88
+ }
87
89
// Maven Publish End
88
90
}
89
91
// {{end:build}}
You can’t perform that action at this time.
0 commit comments