Skip to content

Commit 57112a5

Browse files
authored
Merge pull request #104 from microsoftgraph/feature/code-coverage
feature/code coverage
2 parents 62eab76 + 7f27f14 commit 57112a5

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎.azure-pipelines/buildAndPackage.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ steps:
6868
javaHomeOption: 'JDKVersion'
6969
sonarQubeRunAnalysis: false
7070

71+
- task: PublishCodeCoverageResults@1
72+
inputs:
73+
codeCoverageTool: 'JaCoCo'
74+
summaryFileLocation: $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml
75+
pathToSources: $(System.DefaultWorkingDirectory)/src/main/java
76+
failIfCoverageEmpty: true
77+
7178
- task: PublishBuildArtifacts@1
7279
displayName: 'Publish Artifact: drop'
7380
inputs:

‎.azure-pipelines/prValidate.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ steps:
5252
javaHomeOption: 'JDKVersion'
5353
sonarQubeRunAnalysis: false
5454

55+
- task: PublishCodeCoverageResults@1
56+
inputs:
57+
codeCoverageTool: 'JaCoCo'
58+
summaryFileLocation: $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml
59+
pathToSources: $(System.DefaultWorkingDirectory)/src/main/java
60+
failIfCoverageEmpty: true
61+
5562
- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0
5663
displayName: 'Graph Client Tooling pipeline fail notification'
5764
inputs:

‎build.gradle‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,30 @@ plugins {
1414
id 'maven-publish'
1515
id 'signing'
1616
id 'com.jfrog.bintray' version '1.8.5'
17+
id 'jacoco'
1718
}
1819

1920
java {
2021
modularity.inferModulePath = true
2122
}
2223

24+
test {
25+
finalizedBy jacocoTestReport // report is always generated after tests run
26+
}
27+
jacocoTestReport {
28+
dependsOn test // tests are required to run before generating the report
29+
}
30+
31+
jacoco {
32+
toolVersion = "0.8.7-SNAPSHOT" //https://github.com/gradle/gradle/issues/15038
33+
}
34+
35+
jacocoTestReport {
36+
reports {
37+
xml.enabled true
38+
}
39+
}
40+
2341
sourceSets {
2442
main {
2543
java {
@@ -34,6 +52,7 @@ repositories {
3452
// You can declare any Maven/Ivy/file repository here.
3553
jcenter()
3654
mavenCentral()
55+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } // for jacoco, until 0.8.7 gets released
3756
}
3857

3958
apply from: "gradle/dependencies.gradle"

0 commit comments

Comments
 (0)