Skip to content

Commit f7bd928

Browse files
committed
build: try sonarcloud
1 parent 5800359 commit f7bd928

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

.github/workflows/full-build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,33 @@ jobs:
2828
env:
2929
BUILD_PORT: 0
3030
BUILD_SECURE_PORT: 0
31+
sonar:
32+
name: Sonar
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
38+
- name: Set up JDK 11
39+
uses: actions/setup-java@v1
40+
with:
41+
java-version: 11
42+
- name: Cache SonarCloud packages
43+
uses: actions/cache@v1
44+
with:
45+
path: ~/.sonar/cache
46+
key: ${{ runner.os }}-sonar
47+
restore-keys: ${{ runner.os }}-sonar
48+
- name: Cache Maven packages
49+
uses: actions/cache@v1
50+
with:
51+
path: ~/.m2
52+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
53+
restore-keys: ${{ runner.os }}-m2
54+
- name: Build and analyze
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
57+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
58+
BUILD_PORT: 0
59+
BUILD_SECURE_PORT: 0
60+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@
168168
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ssa</maven.build.timestamp.format>
169169
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
170170
<timestamp>${maven.build.timestamp}</timestamp>
171+
172+
173+
<sonar.projectKey>jooby-project_jooby</sonar.projectKey>
174+
<sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
175+
<sonar.organization>jooby-project</sonar.organization>
176+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
171177
</properties>
172178

173179
<modules>

0 commit comments

Comments
 (0)