Skip to content

Commit

Permalink
Enable publishing of code coverage data to codecov.io
Browse files Browse the repository at this point in the history
Run both coveralls and codecov.io in parallel for a while to compare features and decide which one is better for our use cases. Update readme to include all supported branches and both coverage tools.
  • Loading branch information
tgianos committed May 25, 2018
1 parent 2d8329b commit 34a3365
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -23,6 +23,8 @@ before_script:
- mysql -u root -e 'create database genie;'
- psql -U postgres -c 'create database genie;'
script: ./travis/buildViaTravis.sh
after_success:
- bash <(curl -s https://codecov.io/bash)
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
Expand Down
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -25,9 +25,13 @@ on the [releases](https://netflix.github.io/genie/releases/) page. Click on the

Genie builds are run on Travis CI [here](https://travis-ci.org/Netflix/genie).

| Branch | Build | Coverage |
|:-------:|:-------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Master | [![Build Status](https://travis-ci.org/Netflix/genie.svg?branch=master)](https://travis-ci.org/Netflix/genie) | [![Coverage Status](https://coveralls.io/repos/github/Netflix/genie/badge.svg?branch=master)](https://coveralls.io/github/Netflix/genie?branch=master) |
| Branch | Build | Coverage (coveralls.io) | Coverage (codecov.io) |
|:------:|:-------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------:|
| master | [![Build Status](https://travis-ci.org/Netflix/genie.svg?branch=master)](https://travis-ci.org/Netflix/genie) | [![Coverage Status](https://coveralls.io/repos/github/Netflix/genie/badge.svg?branch=master)](https://coveralls.io/github/Netflix/genie?branch=master) | [![codecov](https://codecov.io/gh/Netflix/genie/branch/master/graph/badge.svg)](https://codecov.io/gh/Netflix/genie/branch/master) |
| 3.3.x | [![Build Status](https://travis-ci.org/Netflix/genie.svg?branch=3.3.x)](https://travis-ci.org/Netflix/genie) | [![Coverage Status](https://coveralls.io/repos/github/Netflix/genie/badge.svg?branch=3.3.x)](https://coveralls.io/github/Netflix/genie?branch=3.3.x) | [![codecov](https://codecov.io/gh/Netflix/genie/branch/3.3.x/graph/badge.svg)](https://codecov.io/gh/Netflix/genie/branch/3.3.x) |
| 3.2.x | [![Build Status](https://travis-ci.org/Netflix/genie.svg?branch=3.2.x)](https://travis-ci.org/Netflix/genie) | [![Coverage Status](https://coveralls.io/repos/github/Netflix/genie/badge.svg?branch=3.2.x)](https://coveralls.io/github/Netflix/genie?branch=3.2.x) | [![codecov](https://codecov.io/gh/Netflix/genie/branch/3.2.x/graph/badge.svg)](https://codecov.io/gh/Netflix/genie/branch/3.2.x) |
| 3.1.x | [![Build Status](https://travis-ci.org/Netflix/genie.svg?branch=3.1.x)](https://travis-ci.org/Netflix/genie) | [![Coverage Status](https://coveralls.io/repos/github/Netflix/genie/badge.svg?branch=3.1.x)](https://coveralls.io/github/Netflix/genie?branch=3.1.x) | [![codecov](https://codecov.io/gh/Netflix/genie/branch/3.1.x/graph/badge.svg)](https://codecov.io/gh/Netflix/genie/branch/3.1.x) |
| 3.0.x | [![Build Status](https://travis-ci.org/Netflix/genie.svg?branch=3.0.x)](https://travis-ci.org/Netflix/genie) | [![Coverage Status](https://coveralls.io/repos/github/Netflix/genie/badge.svg?branch=3.0.x)](https://coveralls.io/github/Netflix/genie?branch=3.0.x) | [![codecov](https://codecov.io/gh/Netflix/genie/branch/3.0.x/graph/badge.svg)](https://codecov.io/gh/Netflix/genie/branch/3.0.x) |

## Docker

Expand Down
62 changes: 30 additions & 32 deletions build.gradle
Expand Up @@ -128,8 +128,8 @@ configure(javaProjects) {
dependency("org.springframework.security.extensions:spring-security-saml2-core:1.0.3.RELEASE")
dependency("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.1.RELEASE")
dependencySet(group: "org.springframework.statemachine", version: "2.0.1.RELEASE") {
entry "spring-statemachine-core"
entry "spring-statemachine-test"
entry "spring-statemachine-core"
entry "spring-statemachine-test"
}
}
}
Expand Down Expand Up @@ -306,54 +306,52 @@ configure(javaProjects) {
}
}

task jacocoRootReport(type: JacocoReport, group: "Coverage reports") {
group = "Coverage Reports"
dependsOn javaProjects.test
additionalSourceDirs = files(javaProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(javaProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(javaProjects.sourceSets.main.output)
executionData = files(javaProjects.jacocoTestReport.executionData)
/**********************************
* Coverage Tasks
**********************************/

task codeCoverageReport(type: JacocoReport, group: "Coverage reports") {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")

dependsOn javaProjects*.test

javaProjects.each {
sourceSets it.sourceSets.main
}

reports {
html.enabled = true
xml.enabled = true
}
onlyIf = {
true
}
doFirst {
executionData = files(
executionData.findAll {
it.exists()
}
)
xml.destination new File("${buildDir}/reports/jacoco/report.xml")
html.enabled = true
html.destination new File("${buildDir}/reports/jacoco/html")
csv.enabled = false
}
afterEvaluate {
// Exclude generated files from top-level coverage report
classDirectories = files(
classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/com/netflix/genie/proto/**",
"**/com/netflix/genie/web/jpa/entities/**",
])
}
classDirectories.files.collect {
fileTree(
dir: it,
exclude: [
"**/com/netflix/genie/proto/**",
"**/com/netflix/genie/web/jpa/entities/*_*",
]
)
}
)
}
}

/**********************************
* Coverage Tasks
**********************************/

coveralls {
sourceDirs = javaProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${project.buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
jacocoReportPath = "${project.buildDir}/reports/jacoco/report.xml"
}

tasks.coveralls {
group = "Coverage reports"
description = "Uploads the aggregated coverage report to Coveralls"

dependsOn jacocoRootReport
dependsOn codeCoverageReport
onlyIf {
System.env."CI"
}
Expand Down
10 changes: 5 additions & 5 deletions travis/buildViaTravis.sh
Expand Up @@ -7,7 +7,7 @@ set -e
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
# Build and run all tests, create coverage report
./gradlew --no-daemon build coveralls
./gradlew --no-daemon build codeCoverageReport coveralls
# Re-run genie-web integration tests with MySQL...
INTEGRATION_TEST_DB=mysql ./gradlew --no-daemon genie-web:integrationTests
# ... and PostgreSQL
Expand All @@ -16,18 +16,18 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
./gradlew --no-daemon javadoc asciidoc dockerBuildAllImages
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew --no-daemon -Prelease.travisBranch=$TRAVIS_BRANCH -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" snapshot coveralls publishGhPages dockerPush
./gradlew --no-daemon -Prelease.travisBranch=$TRAVIS_BRANCH -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" snapshot codeCoverageReport coveralls publishGhPages dockerPush
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
case "$TRAVIS_TAG" in
*-rc\.*)
./gradlew --no-daemon -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" candidate coveralls publishGhPages dockerPush
./gradlew --no-daemon -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" candidate codeCoverageReport coveralls publishGhPages dockerPush
;;
*)
./gradlew --no-daemon -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" final coveralls publishGhPages dockerPush
./gradlew --no-daemon -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" final codeCoverageReport coveralls publishGhPages dockerPush
;;
esac
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew --no-daemon build coveralls
./gradlew --no-daemon build codeCoverageReport coveralls
fi

0 comments on commit 34a3365

Please sign in to comment.