diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a24a65a..a0387cb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,15 +29,24 @@ jobs: - name: Jacoco Report to PR id: jacoco - uses: madrapps/jacoco-report@v1.1 + uses: madrapps/jacoco-report@v1.3 with: - path: ${{ github.workspace }}/build/reports/jacoco/testCoverage/testCoverage.xml + paths: ${{ github.workspace }}/build/reports/jacoco/testCoverage/testCoverage.xml token: ${{ secrets.GITHUB_TOKEN }} min-coverage-overall: 40 min-coverage-changed-files: 60 debug-mode: false + title: Code Coverage + update-comment: true - name: Get the Coverage info run: | echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}" echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}" + + - name: Fail PR if overall coverage is less than 80% + if: ${{ steps.jacoco.outputs.coverage-overall < 80.0 }} + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Overall coverage is less than 80%!') diff --git a/src/main/java/com/madrapps/jacoco/operation/StringOp.java b/src/main/java/com/madrapps/jacoco/operation/StringOp.java index be10d58..e735e51 100644 --- a/src/main/java/com/madrapps/jacoco/operation/StringOp.java +++ b/src/main/java/com/madrapps/jacoco/operation/StringOp.java @@ -9,4 +9,12 @@ public boolean endsWith(String source, String chars) { public boolean startsWith(String source, String chars) { return source.startsWith(chars); } + + public boolean isEmpty(String source) { + return source.isEmpty(); + } + + public String toUpperCase(String source) { + return source.toUpperCase(); + } } diff --git a/src/main/kotlin/com/madrapps/jacoco/Math.kt b/src/main/kotlin/com/madrapps/jacoco/Math.kt index 9352ca2..71bf9f4 100644 --- a/src/main/kotlin/com/madrapps/jacoco/Math.kt +++ b/src/main/kotlin/com/madrapps/jacoco/Math.kt @@ -25,4 +25,12 @@ class Arithmetic { fun area(a: Int, b: Int): Int { return a * b } + + fun negative(a: Int): Int { + return -a + } + + fun positive(a: Int): Int { + return a + } } \ No newline at end of file