Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage reports to Codacy #4454

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/jacocoCoverageReport.xml
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ buildscript {
}
}

plugins {
id 'jacoco'
}

repositories {
mavenCentral()
}

configure(rootProject) {
// remove the 'bisq-*' scripts and 'lib' dir generated by the 'installDist' task
task clean {
Expand All @@ -23,6 +31,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 +667,21 @@ 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
if (!project.hasProperty("only") || it.path.contains("$only"))
sourceSets it.sourceSets.main
}

reports {
xml.enabled true
xml.destination file("${rootProject.projectDir}/build/reports/jacoco/codeCoverageReport/jacocoCoverageReport.xml")
html.enabled true
csv.enabled false
}
}