Skip to content

Commit cd1a9ec

Browse files
committed
Update Sonar configuration
1 parent 4ec38fd commit cd1a9ec

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.github/workflows/pull-request.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches-ignore:
55
- master
66
pull_request:
7-
7+
types: [opened, synchronize, reopened]
88
jobs:
99
validation:
1010
name: Gradle Wrapper Validation

.github/workflows/snapshot.yml

+29
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,32 @@ jobs:
6666
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
6767
BINTRAY_PASS: ${{ secrets.BINTRAY_PASSWORD }}
6868
run: ./gradlew artifactoryPublish -Dsnapshot=true -Dbuild.number=${{ env.GITHUB_RUN_NUMBER }}
69+
sonar:
70+
name: Sonar analysis
71+
needs: validation
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v2
75+
with:
76+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
77+
- name: Set up JDK 11
78+
uses: actions/setup-java@v1
79+
with:
80+
java-version: 11
81+
- name: Cache SonarCloud packages
82+
uses: actions/cache@v1
83+
with:
84+
path: ~/.sonar/cache
85+
key: ${{ runner.os }}-sonar
86+
restore-keys: ${{ runner.os }}-sonar
87+
- name: Cache Gradle packages
88+
uses: actions/cache@v1
89+
with:
90+
path: ~/.gradle/caches
91+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
92+
restore-keys: ${{ runner.os }}-gradle
93+
- name: Build and analyze
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
96+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
97+
run: ./gradlew build sonarqube --info

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ sonarqube {
4646
property "sonar.projectKey", "graphql-java-kickstart_graphql-java-servlet"
4747
property "sonar.organization", "graphql-java-kickstart"
4848
property "sonar.host.url", "https://sonarcloud.io"
49-
property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/*/build/reports/jacoco/test/jacocoTestReport.xml"
49+
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml"
5050
}
5151
}
5252

0 commit comments

Comments
 (0)