Skip to content

Fail the build if test coverage below minimum threshold #590

@remkop

Description

@remkop
Index: build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- build.gradle	(date 1546566279179)
+++ build.gradle	(date 1546566279179)
@@ -60,6 +60,7 @@
     javadoc {
         destinationDir   = file("build/docs/apidocs")
     }
+	javadoc.options.addStringOption('Xdoclint:none', '-quiet')
     // work around https://github.com/gradle/gradle/issues/4046
     javadoc.dependsOn('copyJavadocDocFiles')
     task copyJavadocDocFiles(type: Copy) {
@@ -133,6 +134,18 @@
         html.enabled false
     }
 }
+jacocoTestCoverageVerification {
+    violationRules {
+        rule {
+            limit {
+                minimum = 0.98
+            }
+        }
+    }
+}
+// run coverage verification during the build (and fail when appropriate)
+check.dependsOn jacocoTestCoverageVerification
+
 task bumpReadmeVersion {
     doLast {
         // README.md

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions