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

Fix aggregate JaCoCo task and add codecov integration to Azure #907

Merged
merged 7 commits into from
Jan 16, 2019
Merged
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ install:
script:
# Only run code generation tests on OSX -- linux requires sudo to install OpenCV dependencies, and that environment
# will not be able to run MainWindowTest.testDragOperationFromPaletteToPipeline
- ./gradlew check jacocoTestReport jacocoRootReport --stacktrace -Pheadless=true -PlogTests;
- ./gradlew check --stacktrace -Pheadless=true -PlogTests;

after_success:
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then codecov ; fi
- .travis-scripts/push-javadoc-to-gh-pages.sh
- .travis-scripts/before-deploy.sh

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build_script:

# to run your custom scripts instead of automatic tests
test_script:
- gradlew.bat check jacocoTestReport jacocoRootReport --stacktrace -Pheadless=true -PlogTests -Dscan
- gradlew.bat check --stacktrace -Pheadless=true -PlogTests -Dscan

platform:
- x64
Expand Down
13 changes: 5 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ jobs:
publishJUnitResults: false
tasks: 'check jacocoTestReport jacocoRootReport jfxNative -Pgeneration -PjniLocation=build/OpenCVJNI -Pheadless=true -PlogTests --stacktrace'

# Publish JaCoCo code coverage results from the build
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/reports/jacoco/test/jacocoTestReport.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/reports/jacoco/test/jacocoTestReport.html'
additionalCodeCoverageFiles: '$(System.DefaultWorkingDirectory)/**/build/jacoco/text.exec'
failIfCoverageEmpty: false
- script: |
curl -s https://codecov.io/bash > .codecov
chmod +x .codecov
./.codecov -t $(CODECOV_TOKEN)
displayName: 'Upload jacoco reports to codecov'

- task: CopyFiles@2
inputs:
Expand Down
26 changes: 12 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,20 @@ tasks.register<JacocoReport>("jacocoRootReport") {
group = "Coverage reports"
description = "Generates an aggregate report from all subprojects"

reports {
html.isEnabled = true
xml.isEnabled = true
}
// Based on the codecov Gradle example: https://github.com/codecov/example-gradle

javaSubprojects {
val sourceSets = (this as ExtensionAware).extensions.getByName("sourceSets") as SourceSetContainer
dependsOn(tasks["test"])
val srcFiles = files(sourceSets["main"].allSource.srcDirs)
additionalSourceDirs(srcFiles)
sourceDirectories.from(srcFiles)
classDirectories.from(files(sourceSets["main"].output))
executionData.from(tasks.named<JacocoReport>("jacocoTestReport").map { it.executionData })
}
doFirst {
executionData.setFrom(files(executionData.files.filter { it.exists() }))
this@register.sourceSets(sourceSets["main"])
this@register.dependsOn(tasks.named<JacocoReport>("jacocoTestReport"))
}

executionData(fileTree(rootDir.absolutePath).include("**/build/jacoco/*.exec"))

reports {
xml.isEnabled = true
xml.destination = buildDir.resolve("reports/jacoco/report.xml")
html.isEnabled = false
csv.isEnabled = false
}
}

Expand Down