Skip to content

Commit f2b8199

Browse files
committed
- adds sonarcloud configuration
1 parent 2ce705b commit f2b8199

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/sonarcloud.yml

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

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ plugins {
1515
id 'signing'
1616
id 'jacoco'
1717
id 'com.github.spotbugs' version '4.7.1'
18+
id "org.sonarqube" version "3.1.1"
1819
}
1920

2021
java {
@@ -88,6 +89,14 @@ def pomConfig = {
8889
}
8990
}
9091

92+
sonarqube {
93+
properties {
94+
property "sonar.projectKey", "msgraph-sdk-java-core"
95+
property "sonar.organization", "microsoftgraph"
96+
property "sonar.host.url", "https://sonarcloud.io"
97+
}
98+
}
99+
91100
//Publishing tasks-
92101
//Maven Central Snapshot: publishSnapshotPublicationToMavenRepository
93102
//Maven Central Release: publishMavenCentralReleasePublicationToMaven2Repository

0 commit comments

Comments
 (0)