From cc664ba629c2348c5c34657c082c302a7ae1fbf8 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 18 Jun 2022 14:32:06 +0200 Subject: [PATCH 01/12] Test update comment --- .github/workflows/coverage.yml | 4 +++- src/main/kotlin/com/madrapps/jacoco/Math.kt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a24a65a..237b058 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,13 +29,15 @@ jobs: - name: Jacoco Report to PR id: jacoco - uses: madrapps/jacoco-report@v1.1 + uses: madrapps/jacoco-report@main with: path: ${{ 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: | diff --git a/src/main/kotlin/com/madrapps/jacoco/Math.kt b/src/main/kotlin/com/madrapps/jacoco/Math.kt index 9352ca2..61c3c93 100644 --- a/src/main/kotlin/com/madrapps/jacoco/Math.kt +++ b/src/main/kotlin/com/madrapps/jacoco/Math.kt @@ -25,4 +25,8 @@ class Arithmetic { fun area(a: Int, b: Int): Int { return a * b } + + fun negative(a: Int): Int { + return -a + } } \ No newline at end of file From fe57f357a5f484f2039abddb1ba240ee312b559a Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 18 Jun 2022 14:34:31 +0200 Subject: [PATCH 02/12] path input correction --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 237b058..90a1c0a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -31,7 +31,7 @@ jobs: id: jacoco uses: madrapps/jacoco-report@main 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 From 3e5b59d36ff965fbdc105ad959df1340f00f6f17 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 18 Jun 2022 14:58:35 +0200 Subject: [PATCH 03/12] Add isEmpty --- src/main/java/com/madrapps/jacoco/operation/StringOp.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/madrapps/jacoco/operation/StringOp.java b/src/main/java/com/madrapps/jacoco/operation/StringOp.java index be10d58..8907d06 100644 --- a/src/main/java/com/madrapps/jacoco/operation/StringOp.java +++ b/src/main/java/com/madrapps/jacoco/operation/StringOp.java @@ -9,4 +9,8 @@ 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(); + } } From fb30b228890947e11d1ddd3c5587036d4d108b70 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 18 Jun 2022 15:00:48 +0200 Subject: [PATCH 04/12] Add isBlank --- src/main/java/com/madrapps/jacoco/operation/StringOp.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/madrapps/jacoco/operation/StringOp.java b/src/main/java/com/madrapps/jacoco/operation/StringOp.java index 8907d06..93f374d 100644 --- a/src/main/java/com/madrapps/jacoco/operation/StringOp.java +++ b/src/main/java/com/madrapps/jacoco/operation/StringOp.java @@ -13,4 +13,8 @@ public boolean startsWith(String source, String chars) { public boolean isEmpty(String source) { return source.isEmpty(); } + + public boolean isBlank(String source) { + return source.isBlank(); + } } From 3517bee5e5eccfaf6d5b539eb560f7da7641b7d3 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 18 Jun 2022 15:04:38 +0200 Subject: [PATCH 05/12] Add toUpperCase --- src/main/java/com/madrapps/jacoco/operation/StringOp.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/madrapps/jacoco/operation/StringOp.java b/src/main/java/com/madrapps/jacoco/operation/StringOp.java index 93f374d..e735e51 100644 --- a/src/main/java/com/madrapps/jacoco/operation/StringOp.java +++ b/src/main/java/com/madrapps/jacoco/operation/StringOp.java @@ -14,7 +14,7 @@ public boolean isEmpty(String source) { return source.isEmpty(); } - public boolean isBlank(String source) { - return source.isBlank(); + public String toUpperCase(String source) { + return source.toUpperCase(); } } From b9748e160daf7a2d05efff15a83674ca8fe31093 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:38:49 +0200 Subject: [PATCH 06/12] Update workflow to fail --- .github/workflows/coverage.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 90a1c0a..282ece1 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,7 +29,7 @@ jobs: - name: Jacoco Report to PR id: jacoco - uses: madrapps/jacoco-report@main + uses: madrapps/jacoco-report@v1.3 with: paths: ${{ github.workspace }}/build/reports/jacoco/testCoverage/testCoverage.xml token: ${{ secrets.GITHUB_TOKEN }} @@ -43,3 +43,10 @@ jobs: 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 + uses: actions/github-script@v3 + with: + script: | + core.setFailed('Overall coverage is less than 80%!') From 371958e69a5da5c468475378e408c05f9d895b9a Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:39:57 +0200 Subject: [PATCH 07/12] Update Math file --- src/main/kotlin/com/madrapps/jacoco/Math.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/com/madrapps/jacoco/Math.kt b/src/main/kotlin/com/madrapps/jacoco/Math.kt index 61c3c93..71bf9f4 100644 --- a/src/main/kotlin/com/madrapps/jacoco/Math.kt +++ b/src/main/kotlin/com/madrapps/jacoco/Math.kt @@ -29,4 +29,8 @@ class Arithmetic { fun negative(a: Int): Int { return -a } + + fun positive(a: Int): Int { + return a + } } \ No newline at end of file From 27a2734d6294b7857f21b7a5f978c1b6b3539720 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:43:57 +0200 Subject: [PATCH 08/12] Update coverage file --- .github/workflows/coverage.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 282ece1..7e57126 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -46,7 +46,7 @@ jobs: - name: Fail PR if overall coverage is less than 80% if: ${{ steps.jacoco.outputs.coverage-overall }} < 80 - uses: actions/github-script@v3 - with: - script: | - core.setFailed('Overall coverage is less than 80%!') + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Overall coverage is less than 80%!') From 5bf5dc1f5c2b663de2184e69e399149a936556c3 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:45:32 +0200 Subject: [PATCH 09/12] Update to check if the PR passes --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7e57126..994f882 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -45,7 +45,7 @@ jobs: 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 + if: ${{ steps.jacoco.outputs.coverage-overall }} < 30 uses: actions/github-script@v6 with: script: | From bcbaa232dea336d6c91615ae4e3d5ed69244d248 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:49:04 +0200 Subject: [PATCH 10/12] Update to check if the PR passes --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 994f882..1f49e00 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -45,7 +45,7 @@ jobs: 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 }} < 30 + if: ${{ steps.jacoco.outputs.coverage-overall }} < 30.0 uses: actions/github-script@v6 with: script: | From ea186d754bfdd60cdbcef5b1f3ea19ae6f8936d4 Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:50:17 +0200 Subject: [PATCH 11/12] Update to check if the PR passes --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1f49e00..ab1f4de 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -45,7 +45,7 @@ jobs: 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 }} < 30.0 + if: ${{ steps.jacoco.outputs.coverage-overall < 30.0 }} uses: actions/github-script@v6 with: script: | From 7ac84049d618bdce9d86395354436bede6f7c4ac Mon Sep 17 00:00:00 2001 From: thsaravana Date: Sat, 10 Sep 2022 07:52:27 +0200 Subject: [PATCH 12/12] Update to check if the PR passes --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ab1f4de..a0387cb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -45,7 +45,7 @@ jobs: 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 < 30.0 }} + if: ${{ steps.jacoco.outputs.coverage-overall < 80.0 }} uses: actions/github-script@v6 with: script: |