diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 58e1c59..6fc94d3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,11 +16,20 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 + - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Build with Gradle run: ./gradlew build + + - name: Generate coverage + run: ./gradlew codeCoverageReport + + - name: Codecov + uses: codecov/codecov-action@v1.0.12 diff --git a/build.gradle b/build.gradle index 16d98b7..e5287da 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ group 'io.visual-regression-tracker.sdk-java' version '3.1.0' apply plugin: 'java' +apply plugin: 'jacoco' apply plugin: "io.freefair.lombok" apply plugin: "com.github.johnrengelman.shadow" @@ -34,4 +35,25 @@ dependencies { test { useTestNG() + finalizedBy jacocoTestReport // report is always generated after tests run +} + +// codecov integration https://github.com/codecov/example-gradle +task codeCoverageReport(type: JacocoReport) { + executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec") + + subprojects.each { + sourceSets it.sourceSets.main + } + + reports { + xml.enabled true + xml.destination file("${buildDir}/reports/jacoco/report.xml") + html.enabled false + csv.enabled false + } +} + +codeCoverageReport.dependsOn { + subprojects*.test } \ No newline at end of file diff --git a/lombok.config b/lombok.config index 6aa51d7..189c0be 100644 --- a/lombok.config +++ b/lombok.config @@ -1,2 +1,3 @@ # This file is generated by the 'io.freefair.lombok' Gradle plugin config.stopBubbling = true +lombok.addLombokGeneratedAnnotation = true