diff --git a/.travis.yml b/.travis.yml index 69865ad8697..f4370a5c815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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/ diff --git a/README.md b/README.md index 4d9e5fe7426..63306c361b0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build.gradle b/build.gradle index 14e395263b8..3b9a8538ea2 100644 --- a/build.gradle +++ b/build.gradle @@ -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" } } } @@ -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" } diff --git a/travis/buildViaTravis.sh b/travis/buildViaTravis.sh index 71273df521a..05c216c3a9e 100755 --- a/travis/buildViaTravis.sh +++ b/travis/buildViaTravis.sh @@ -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 @@ -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