From d10fbbd396585cc0cf1f5cee8dcc8c388a80dbac Mon Sep 17 00:00:00 2001 From: Nilton Constantino Date: Wed, 19 Feb 2025 13:38:58 +0000 Subject: [PATCH 01/20] add withChecks into pipeline --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 564029b..2d21f33 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,11 +4,11 @@ pipeline { stages { stage('Test') { steps { -// withChecks(name: 'Test', includeStage: true) { + withChecks(name: 'Test', includeStage: true) { echo 'Testing..' sh './gradlew clean test' junit '**/build/test-results/test/TEST-*.xml' -// } + } } } } -- 2.47.2 From 8d620984e3f12deed36333c8f78fa3faf6d6caa3 Mon Sep 17 00:00:00 2001 From: Nilton Constantino Date: Wed, 19 Feb 2025 14:10:53 +0000 Subject: [PATCH 02/20] add withChecks into pipeline --- Jenkinsfile | 2 +- app/build.gradle.kts | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2d21f33..705765f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stages { stage('Test') { steps { - withChecks(name: 'Test', includeStage: true) { + withChecks(name: 'Test') { echo 'Testing..' sh './gradlew clean test' junit '**/build/test-results/test/TEST-*.xml' diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f8889ae..1cb54dd 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -9,6 +9,7 @@ plugins { // Apply the application plugin to add support for building a CLI application in Java. application + jacoco } repositories { @@ -22,6 +23,7 @@ dependencies { // This dependency is used by the application. implementation("com.google.guava:guava:31.1-jre") + implementation("org.jacoco:org.jacoco.core:0.8.12") } // Apply a specific Java toolchain to ease working on different environments. @@ -31,6 +33,32 @@ java { } } +jacoco { + toolVersion = "0.8.12" +} + +tasks.jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = "0.4".toBigDecimal() + } + } + + rule { + isEnabled = false + element = "CLASS" + includes = listOf("jenkins.test.*") + + limit { + counter = "LINE" + value = "TOTALCOUNT" + maximum = "0.3".toBigDecimal() + } + } + } +} + application { // Define the main class for the application. mainClass.set("jenkins.test.App") -- 2.47.2 From 9c34ce094f291371d54b3fd3654f019418f905e9 Mon Sep 17 00:00:00 2001 From: Nilton Constantino Date: Wed, 19 Feb 2025 14:13:24 +0000 Subject: [PATCH 03/20] add withChecks into pipeline --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 705765f..e324df4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { steps { withChecks(name: 'Test') { echo 'Testing..' - sh './gradlew clean test' + sh './gradlew clean jacocoTestReport jacocoTestCoverageVerification' junit '**/build/test-results/test/TEST-*.xml' } } -- 2.47.2 From aae261ffa3c2718792a9beef3d1692960c6d3016 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 14:20:06 +0000 Subject: [PATCH 04/20] add withChecks into pipeline --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e324df4..07a6c2a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { steps { withChecks(name: 'Test') { echo 'Testing..' - sh './gradlew clean jacocoTestReport jacocoTestCoverageVerification' + sh './gradlew clean test jacocoTestReport jacocoTestCoverageVerification' junit '**/build/test-results/test/TEST-*.xml' } } -- 2.47.2 From 983b67833b438720bdfabc8c9c2f8d2f2f74d12b Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 14:27:33 +0000 Subject: [PATCH 05/20] add withChecks into pipeline --- Jenkinsfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07a6c2a..6098460 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,11 +2,16 @@ pipeline { agent any stages { - stage('Test') { + stage('build') { steps { - withChecks(name: 'Test') { - echo 'Testing..' - sh './gradlew clean test jacocoTestReport jacocoTestCoverageVerification' + withChecks(name: 'build', in) { + sh './gradlew clean testClasses' + } + withChecks(name: 'unit-tests', in) { + sh './gradlew test' + } + withChecks(name: 'test-coverage', in) { + sh './gradlew jacocoTestReport jacocoTestCoverageVerification' junit '**/build/test-results/test/TEST-*.xml' } } -- 2.47.2 From 4b57b3d45a4eb0ff954926f6be3d3e83acab7e62 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 14:28:27 +0000 Subject: [PATCH 06/20] add withChecks into pipeline --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6098460..3008c84 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,13 +4,13 @@ pipeline { stages { stage('build') { steps { - withChecks(name: 'build', in) { + withChecks(name: 'build', includeStage: true) { sh './gradlew clean testClasses' } - withChecks(name: 'unit-tests', in) { + withChecks(name: 'unit-tests', includeStage: true) { sh './gradlew test' } - withChecks(name: 'test-coverage', in) { + withChecks(name: 'test-coverage', includeStage: true) { sh './gradlew jacocoTestReport jacocoTestCoverageVerification' junit '**/build/test-results/test/TEST-*.xml' } -- 2.47.2 From f26cfa6950a4487597efb46f743e12dbfd76a465 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 14:34:54 +0000 Subject: [PATCH 07/20] add withChecks into pipeline --- Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3008c84..e26b6da 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,13 @@ pipeline { withChecks(name: 'test-coverage', includeStage: true) { sh './gradlew jacocoTestReport jacocoTestCoverageVerification' junit '**/build/test-results/test/TEST-*.xml' + recordCoverage(tools: [[parser: 'JACOCO']], + id: 'jacoco', name: 'JaCoCo Coverage', + sourceCodeRetention: 'EVERY_BUILD' +// , qualityGates: [ +// [threshold: 60.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], +// [threshold: 60.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] + ) } } } -- 2.47.2 From b3e3a68736e8636f4548641005ad9e6c4b96f4fb Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 14:38:25 +0000 Subject: [PATCH 08/20] add withChecks into pipeline --- Jenkinsfile | 6 +++--- app/build.gradle.kts | 46 ++++++++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e26b6da..41bdb6d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,9 +16,9 @@ pipeline { recordCoverage(tools: [[parser: 'JACOCO']], id: 'jacoco', name: 'JaCoCo Coverage', sourceCodeRetention: 'EVERY_BUILD' -// , qualityGates: [ -// [threshold: 60.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], -// [threshold: 60.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] + , qualityGates: [ + [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] ) } } diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1cb54dd..f287f99 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -37,28 +37,36 @@ jacoco { toolVersion = "0.8.12" } -tasks.jacocoTestCoverageVerification { - violationRules { - rule { - limit { - minimum = "0.4".toBigDecimal() - } - } - - rule { - isEnabled = false - element = "CLASS" - includes = listOf("jenkins.test.*") - - limit { - counter = "LINE" - value = "TOTALCOUNT" - maximum = "0.3".toBigDecimal() - } - } +tasks.jacocoTestReport { + reports { + xml.required = true + csv.required = false + html.required = false } } +//tasks.jacocoTestCoverageVerification { +// violationRules { +// rule { +// limit { +// minimum = "0.4".toBigDecimal() +// } +// } +// +// rule { +// isEnabled = false +// element = "CLASS" +// includes = listOf("jenkins.test.*") +// +// limit { +// counter = "LINE" +// value = "TOTALCOUNT" +// maximum = "0.3".toBigDecimal() +// } +// } +// } +//} + application { // Define the main class for the application. mainClass.set("jenkins.test.App") -- 2.47.2 From a86ddef535e0761d45818158cf3c7e3650728dec Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 15:00:51 +0000 Subject: [PATCH 09/20] add withChecks into pipeline --- Jenkinsfile | 6 ++--- app/build.gradle.kts | 54 ++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 41bdb6d..c43dd88 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,9 +16,9 @@ pipeline { recordCoverage(tools: [[parser: 'JACOCO']], id: 'jacoco', name: 'JaCoCo Coverage', sourceCodeRetention: 'EVERY_BUILD' - , qualityGates: [ - [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], - [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] +// , qualityGates: [ +// [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], +// [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] ) } } diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f287f99..9c71e65 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -37,36 +37,36 @@ jacoco { toolVersion = "0.8.12" } -tasks.jacocoTestReport { - reports { - xml.required = true - csv.required = false - html.required = false - } -} - -//tasks.jacocoTestCoverageVerification { -// violationRules { -// rule { -// limit { -// minimum = "0.4".toBigDecimal() -// } -// } -// -// rule { -// isEnabled = false -// element = "CLASS" -// includes = listOf("jenkins.test.*") -// -// limit { -// counter = "LINE" -// value = "TOTALCOUNT" -// maximum = "0.3".toBigDecimal() -// } -// } +//tasks.jacocoTestReport { +// reports { +// xml.required = true +// csv.required = false +// html.required = true // } //} +tasks.jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = "0.4".toBigDecimal() + } + } + + rule { + isEnabled = true + element = "CLASS" + includes = listOf("jenkins.test.*") + + limit { + counter = "LINE" + value = "TOTALCOUNT" + minimum = "0.3".toBigDecimal() + } + } + } +} + application { // Define the main class for the application. mainClass.set("jenkins.test.App") -- 2.47.2 From 9ec20b53e34bf95ec1405c0f2eaebfc8d58399ec Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 15:29:54 +0000 Subject: [PATCH 10/20] add withChecks into pipeline --- Jenkinsfile | 8 +------- app/build.gradle.kts | 14 +++++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c43dd88..134ca96 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,14 +4,8 @@ pipeline { stages { stage('build') { steps { - withChecks(name: 'build', includeStage: true) { - sh './gradlew clean testClasses' - } - withChecks(name: 'unit-tests', includeStage: true) { - sh './gradlew test' - } withChecks(name: 'test-coverage', includeStage: true) { - sh './gradlew jacocoTestReport jacocoTestCoverageVerification' + sh './gradlew clean test jacocoTestReport jacocoTestCoverageVerification' junit '**/build/test-results/test/TEST-*.xml' recordCoverage(tools: [[parser: 'JACOCO']], id: 'jacoco', name: 'JaCoCo Coverage', diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 9c71e65..b163145 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -37,13 +37,13 @@ jacoco { toolVersion = "0.8.12" } -//tasks.jacocoTestReport { -// reports { -// xml.required = true -// csv.required = false -// html.required = true -// } -//} +tasks.jacocoTestReport { + reports { + xml.required.set(true) + csv.required.set(false) + html.required.set(true) + } +} tasks.jacocoTestCoverageVerification { violationRules { -- 2.47.2 From 39a361ec4138e4e2fe48f3ec98a5a0c7ee22e929 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 15:39:04 +0000 Subject: [PATCH 11/20] add withChecks into pipeline --- app/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b163145..8dbdb1d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -40,6 +40,7 @@ jacoco { tasks.jacocoTestReport { reports { xml.required.set(true) + xml.outputLocation.set(file("build/reports/jacoco/test/jacoco.xml")) csv.required.set(false) html.required.set(true) } -- 2.47.2 From 407bc6311c32cd091bb4dbdefcd53f7c3e137268 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 15:43:41 +0000 Subject: [PATCH 12/20] add withChecks into pipeline --- Jenkinsfile | 2 +- app/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 134ca96..8309287 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { steps { withChecks(name: 'test-coverage', includeStage: true) { sh './gradlew clean test jacocoTestReport jacocoTestCoverageVerification' - junit '**/build/test-results/test/TEST-*.xml' +// junit '**/build/test-results/test/TEST-*.xml' recordCoverage(tools: [[parser: 'JACOCO']], id: 'jacoco', name: 'JaCoCo Coverage', sourceCodeRetention: 'EVERY_BUILD' diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8dbdb1d..a09665b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -42,7 +42,7 @@ tasks.jacocoTestReport { xml.required.set(true) xml.outputLocation.set(file("build/reports/jacoco/test/jacoco.xml")) csv.required.set(false) - html.required.set(true) + html.required.set(false) } } -- 2.47.2 From 260354a00970cf21b39d89e849b703cfffcc2bf7 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 15:53:23 +0000 Subject: [PATCH 13/20] add withChecks into pipeline --- app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a09665b..115a4c7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -50,12 +50,12 @@ tasks.jacocoTestCoverageVerification { violationRules { rule { limit { - minimum = "0.4".toBigDecimal() + minimum = "0.9".toBigDecimal() } } rule { - isEnabled = true + isEnabled = false element = "CLASS" includes = listOf("jenkins.test.*") -- 2.47.2 From 137ab417ec04d1529ec86c194578ae57ff1b8a36 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 19 Feb 2025 15:56:55 +0000 Subject: [PATCH 14/20] add withChecks into pipeline --- Jenkinsfile | 13 ++++++++----- app/build.gradle.kts | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8309287..0b60f73 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,13 +2,16 @@ pipeline { agent any stages { - stage('build') { + stage('app') { steps { - withChecks(name: 'test-coverage', includeStage: true) { - sh './gradlew clean test jacocoTestReport jacocoTestCoverageVerification' -// junit '**/build/test-results/test/TEST-*.xml' + withChecks(name: 'build', includeStage: false) { + sh './gradlew clean testClasses' + } + withChecks(name: 'test-coverage', includeStage: false) { + sh './gradlew test jacocoTestReport jacocoTestCoverageVerification' + junit '**/build/test-results/test/TEST-*.xml' recordCoverage(tools: [[parser: 'JACOCO']], - id: 'jacoco', name: 'JaCoCo Coverage', + id: 'jacoco', name: 'jacoco-coverage', sourceCodeRetention: 'EVERY_BUILD' // , qualityGates: [ // [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 115a4c7..86a9052 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -50,7 +50,7 @@ tasks.jacocoTestCoverageVerification { violationRules { rule { limit { - minimum = "0.9".toBigDecimal() + minimum = "0.2".toBigDecimal() } } -- 2.47.2 From 0f83b57066e165c100a1f1a31b388f2450b3ec03 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Thu, 20 Feb 2025 06:40:07 +0000 Subject: [PATCH 15/20] add withChecks into pipeline --- Jenkinsfile | 61 ++++++++++++++++++++++++++++++++++---------- app/build.gradle.kts | 45 ++++++++++++++++---------------- 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b60f73..c419f7c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,25 +2,58 @@ pipeline { agent any stages { - stage('app') { + stage('Build') { steps { withChecks(name: 'build', includeStage: false) { - sh './gradlew clean testClasses' + withGradle { + sh """ + ./gradlew clean testClasses --no-daemon + """ + } } + } + } // Build + + stage('Test') { + steps { withChecks(name: 'test-coverage', includeStage: false) { - sh './gradlew test jacocoTestReport jacocoTestCoverageVerification' - junit '**/build/test-results/test/TEST-*.xml' - recordCoverage(tools: [[parser: 'JACOCO']], - id: 'jacoco', name: 'jacoco-coverage', - sourceCodeRetention: 'EVERY_BUILD' -// , qualityGates: [ -// [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], -// [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] + withGradle { + sh """ + ./gradlew test jacocoTestReport jacocoTestCoverageVerification --no-daemon + """ + } + recordCoverage(tools: [[parser: 'JACOCO', pattern: '**/build/reports/jacoco/test/jacoco*.xml']], + id: 'jacoco', + name: 'Jacoco Coverage', + sourceCodeRetention: 'EVERY_BUILD', + qualityGates: [ + [threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'METHOD', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] + ) } } - } + } // Test + + stage('Post') { + steps { + script { + junit '**/build/test-results/test/TEST-*.xml' + // archiveArtifacts artifacts: '**/coverage-sources.zip', allowEmptyArchive: false, fingerprint: false, onlyIfSuccessful: false + publishHTML (target: [ + allowMissing: true, + alwaysLinkToLastBuild: false, + keepAll: true, + reportDir: 'app/build/reports/jacoco/test/html', + reportFiles: 'index.html', + reportName: 'Coverage Report' + ]) + // def pmd = scanForIssues tool: [$class: 'Pmd'], pattern: 'lib/build/reports/pmd/*.xml' + // publishIssues issues: [pmd] + } + } + } // Post } -} - - +} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 86a9052..8df3e47 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -40,33 +40,32 @@ jacoco { tasks.jacocoTestReport { reports { xml.required.set(true) - xml.outputLocation.set(file("build/reports/jacoco/test/jacoco.xml")) csv.required.set(false) - html.required.set(false) + html.required.set(true) } } -tasks.jacocoTestCoverageVerification { - violationRules { - rule { - limit { - minimum = "0.2".toBigDecimal() - } - } - - rule { - isEnabled = false - element = "CLASS" - includes = listOf("jenkins.test.*") - - limit { - counter = "LINE" - value = "TOTALCOUNT" - minimum = "0.3".toBigDecimal() - } - } - } -} +//tasks.jacocoTestCoverageVerification { +// violationRules { +// rule { +// limit { +// minimum = "0.2".toBigDecimal() +// } +// } +// +// rule { +// isEnabled = false +// element = "CLASS" +// includes = listOf("jenkins.test.*") +// +// limit { +// counter = "LINE" +// value = "TOTALCOUNT" +// minimum = "0.3".toBigDecimal() +// } +// } +// } +//} application { // Define the main class for the application. -- 2.47.2 From 5c649f34813579cdabb42a456b52fb1abc51349e Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Thu, 20 Feb 2025 07:07:26 +0000 Subject: [PATCH 16/20] add withChecks into pipeline --- Jenkinsfile | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c419f7c..b0eb374 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,24 +2,24 @@ pipeline { agent any stages { + // stage('Build') { + // steps { + // withChecks(name: 'build', includeStage: false) { + // withGradle { + // sh """ + // ./gradlew clean testClasses --no-daemon + // """ + // } + // } + // } + // } // Build + stage('Build') { steps { - withChecks(name: 'build', includeStage: false) { + withChecks(name: 'Test', includeStage: false) { withGradle { sh """ - ./gradlew clean testClasses --no-daemon - """ - } - } - } - } // Build - - stage('Test') { - steps { - withChecks(name: 'test-coverage', includeStage: false) { - withGradle { - sh """ - ./gradlew test jacocoTestReport jacocoTestCoverageVerification --no-daemon + ./gradlew clean test jacocoTestReport jacocoTestCoverageVerification --no-daemon """ } recordCoverage(tools: [[parser: 'JACOCO', pattern: '**/build/reports/jacoco/test/jacoco*.xml']], @@ -27,20 +27,19 @@ pipeline { name: 'Jacoco Coverage', sourceCodeRetention: 'EVERY_BUILD', qualityGates: [ - [threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT', unstable: true], - [threshold: 40.0, metric: 'METHOD', baseline: 'PROJECT', unstable: true], - [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], - [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]] - - ) + [threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT'], + [threshold: 40.0, metric: 'METHOD', baseline: 'PROJECT'], + [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT'], + [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT']]) + junit testResults: '**/build/test-results/test/TEST-*.xml' } } } // Test - stage('Post') { + stage('Reports') { steps { script { - junit '**/build/test-results/test/TEST-*.xml' + // junit skipPublishingChecks: true, testResults: '**/build/test-results/test/TEST-*.xml' // archiveArtifacts artifacts: '**/coverage-sources.zip', allowEmptyArchive: false, fingerprint: false, onlyIfSuccessful: false publishHTML (target: [ allowMissing: true, -- 2.47.2 From 5ee039ba1b1019761d789e84d58df8e8dad548f2 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Thu, 20 Feb 2025 07:26:16 +0000 Subject: [PATCH 17/20] add withChecks into pipeline --- Jenkinsfile | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0eb374..d7f650a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,21 +2,9 @@ pipeline { agent any stages { - // stage('Build') { - // steps { - // withChecks(name: 'build', includeStage: false) { - // withGradle { - // sh """ - // ./gradlew clean testClasses --no-daemon - // """ - // } - // } - // } - // } // Build - stage('Build') { steps { - withChecks(name: 'Test', includeStage: false) { + withChecks(name: 'Test', includeStage: true) { withGradle { sh """ ./gradlew clean test jacocoTestReport jacocoTestCoverageVerification --no-daemon @@ -39,7 +27,6 @@ pipeline { stage('Reports') { steps { script { - // junit skipPublishingChecks: true, testResults: '**/build/test-results/test/TEST-*.xml' // archiveArtifacts artifacts: '**/coverage-sources.zip', allowEmptyArchive: false, fingerprint: false, onlyIfSuccessful: false publishHTML (target: [ allowMissing: true, @@ -53,6 +40,6 @@ pipeline { // publishIssues issues: [pmd] } } - } // Post + } // Reports } } \ No newline at end of file -- 2.47.2 From 1be54f4ca03cf176e38e3c1db79fa750b0664058 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Thu, 20 Feb 2025 07:28:15 +0000 Subject: [PATCH 18/20] add withChecks into pipeline --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d7f650a..a709cd8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } recordCoverage(tools: [[parser: 'JACOCO', pattern: '**/build/reports/jacoco/test/jacoco*.xml']], id: 'jacoco', - name: 'Jacoco Coverage', + name: 'JaCoCo Coverage', sourceCodeRetention: 'EVERY_BUILD', qualityGates: [ [threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT'], -- 2.47.2 From 4f783e4719e838c37492ac110641ea834ae72643 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Thu, 20 Feb 2025 07:52:42 +0000 Subject: [PATCH 19/20] add withChecks into pipeline --- Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a709cd8..43cdf4b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,10 +15,11 @@ pipeline { name: 'JaCoCo Coverage', sourceCodeRetention: 'EVERY_BUILD', qualityGates: [ - [threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT'], - [threshold: 40.0, metric: 'METHOD', baseline: 'PROJECT'], - [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT'], - [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT']]) + [threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'METHOD', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'LINE', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'INSTRUCTION', baseline: 'PROJECT', unstable: true], + [threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]]) junit testResults: '**/build/test-results/test/TEST-*.xml' } } -- 2.47.2 From b6a73fb3e2e26c7405d1117100c3a559916068e6 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Thu, 20 Feb 2025 08:07:00 +0000 Subject: [PATCH 20/20] add withChecks into pipeline --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e69de29..abee2df 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +[SIMPLE TEST FOR JENKINS] \ No newline at end of file -- 2.47.2