Skip to content

Commit 4ef1499

Browse files
authored
Merge pull request #829 from eclipse/sonar
Sonar config
2 parents 32d7643 + 58157b1 commit 4ef1499

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,34 @@ jobs:
3131
- uses: actions/checkout@v2
3232
- name: Set Image Version
3333
run: echo "IMAGE_VERSION=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
34+
- name: SonarCloud Scan webui, cli
35+
uses: SonarSource/sonarcloud-github-action@master
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
38+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3439
- name: Build CLI
3540
run: yarn --cwd cli
3641
- name: Build Web UI Image
3742
run: docker build -t $WEBUI_TAG:$IMAGE_VERSION webui
3843
- name: Run Server Tests
3944
run: server/gradlew --no-daemon -p server check
45+
- name: Cache SonarCloud packages
46+
uses: actions/cache@v3
47+
with:
48+
path: ~/.sonar/cache
49+
key: ${{ runner.os }}-sonar
50+
restore-keys: ${{ runner.os }}-sonar
51+
- name: Cache Gradle packages
52+
uses: actions/cache@v3
53+
with:
54+
path: ~/.gradle/caches
55+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
56+
restore-keys: ${{ runner.os }}-gradle
57+
- name: SonarCloud Scan server
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
60+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61+
run: server/gradlew --no-daemon -p server build sonar --info
4062
- name: Build Server Image
4163
run: docker build -t $SERVER_TAG:$IMAGE_VERSION server
4264
- name: Push Docker Images

server/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ buildscript {
77
}
88
}
99
plugins {
10+
id "org.sonarqube" version "4.4.1.3373"
1011
id 'nu.studer.jooq' version '8.2.1'
1112
id 'de.undercouch.download' version '5.4.0'
1213
id 'org.springframework.boot' version '3.1.0'
@@ -123,6 +124,14 @@ dependencies {
123124
gatling "io.gatling:gatling-app:${versions.gatling}"
124125
}
125126

127+
sonar {
128+
properties {
129+
property "sonar.projectKey", "open-vsx_openvsx"
130+
property "sonar.organization", "open-vsx"
131+
property "sonar.host.url", "https://sonarcloud.io"
132+
}
133+
}
134+
126135
jooq {
127136
// use jOOQ version defined in Spring Boot
128137
version = dependencyManagement.importedProperties['jooq.version']

sonar-project.properties

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

0 commit comments

Comments
 (0)