Skip to content

Commit df24d2b

Browse files
author
Justin Abrahms
authored
Merge pull request #18 from open-feature/coverage
Add coverage validation
2 parents 1e71a6b + 5142883 commit df24d2b

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.github/workflows/merge.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ jobs:
3131
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
3232
with:
3333
arguments: build
34+
- name: Upload coverage to Codecov
35+
uses: codecov/codecov-action@v2
36+
with:
37+
directory: lib/build
38+
flags: unittests # optional
39+
name: coverage # optional
40+
fail_ci_if_error: true # optional (default = false)
41+
verbose: true # optional (default = false)
3442
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
3543
# the publishing section of your build.gradle
3644
- name: Publish to Sonatype (Maven)

.github/workflows/pullrequest.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ jobs:
3030
- name: Build with Gradle
3131
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
3232
with:
33-
arguments: build
33+
arguments: build
34+
- name: Upload coverage to Codecov
35+
uses: codecov/codecov-action@v2
36+
with:
37+
directory: lib/build
38+
flags: unittests # optional
39+
name: pr coverage # optional
40+
fail_ci_if_error: true # optional (default = false)
41+
verbose: true # optional (default = false)

lib/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313
id 'pmd'
1414
id 'maven-publish'
1515
id 'signing'
16+
id 'jacoco'
1617
}
1718

1819
pmd {
@@ -44,6 +45,16 @@ tasks.named('test') {
4445
useJUnitPlatform()
4546
}
4647

48+
test {
49+
finalizedBy jacocoTestReport // report is always generated after tests run
50+
}
51+
jacocoTestReport {
52+
dependsOn test // tests are required to run before generating the report
53+
reports {
54+
xml.required = true
55+
}
56+
}
57+
4758
task sourcesJar(type: Jar, dependsOn: classes) {
4859
archiveClassifier = 'sources'
4960
archiveBaseName = 'openfeature'
@@ -54,7 +65,6 @@ artifacts {
5465
archives sourcesJar
5566
}
5667

57-
5868
jar.archiveBaseName = 'openfeature'
5969

6070
def repo_url = System.getenv("REPOSITORY_URL")

0 commit comments

Comments
 (0)