Skip to content

Commit

Permalink
Add code coverage reports to Codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
freimair committed Sep 2, 2020
1 parent 9c13ced commit 7bad93d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ install:

before_install:
grep -v '^#' assets/src/main/resources/META-INF/services/bisq.asset.Asset | sort --check --dictionary-order --ignore-case

script:
- ./gradlew clean check codeCoverageReport

after_success:
- bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r build/reports/jacoco/codeCoverageReport/jacoco.xml
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ buildscript {
}
}

plugins {
id 'jacoco'
}

repositories {
mavenCentral()
}

configure(rootProject) {

// remove the 'bisq-*' scripts and 'lib' dir generated by the 'installDist' task
task clean {
doLast {
Expand All @@ -23,6 +32,7 @@ configure(rootProject) {
configure(subprojects) {
apply plugin: 'java'
apply plugin: 'com.google.osdetector'
apply plugin: 'jacoco'

sourceCompatibility = 1.10

Expand Down Expand Up @@ -658,3 +668,19 @@ configure(project(':apitest')) {
}
}

task codeCoverageReport(type: JacocoReport) {
// Gather execution data from all subprojects
getExecutionData().setFrom(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))

// Add all relevant sourcesets from the subprojects
subprojects.each {
if (!it.path.contains(":proto")) // but skip proto, as it will never receive any test
sourceSets it.sourceSets.main
}

reports {
xml.enabled true
html.enabled false
csv.enabled false
}
}

0 comments on commit 7bad93d

Please sign in to comment.