diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 603635a1..12d33562 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -31,6 +31,14 @@ jobs: uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee with: arguments: build + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + directory: lib/build + flags: unittests # optional + name: coverage # optional + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) # The USERNAME and TOKEN need to correspond to the credentials environment variables used in # the publishing section of your build.gradle - name: Publish to Sonatype (Maven) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index b317d746..231eb0f6 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -30,4 +30,12 @@ jobs: - name: Build with Gradle uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee with: - arguments: build \ No newline at end of file + arguments: build + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + directory: lib/build + flags: unittests # optional + name: pr coverage # optional + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) \ No newline at end of file diff --git a/lib/build.gradle b/lib/build.gradle index c0bcacd7..4a782cf2 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -13,6 +13,7 @@ plugins { id 'pmd' id 'maven-publish' id 'signing' + id 'jacoco' } pmd { @@ -44,6 +45,16 @@ tasks.named('test') { useJUnitPlatform() } +test { + finalizedBy jacocoTestReport // report is always generated after tests run +} +jacocoTestReport { + dependsOn test // tests are required to run before generating the report + reports { + xml.required = true + } +} + task sourcesJar(type: Jar, dependsOn: classes) { archiveClassifier = 'sources' archiveBaseName = 'openfeature' @@ -54,7 +65,6 @@ artifacts { archives sourcesJar } - jar.archiveBaseName = 'openfeature' def repo_url = System.getenv("REPOSITORY_URL")