Compare commits

...

10 Commits

Author SHA1 Message Date
0f83b57066 add withChecks into pipeline
Some checks are pending
build
test-coverage
Tests / Post passed: 1
Jacoco Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 50.00% (2/4) * Lines of Code: 4 * Cyclomatic Complexity: 3 #### Quality Gates Summary Overall result: Success Output truncated.
Test passed: 1
2025-02-20 06:40:07 +00:00
137ab417ec add withChecks into pipeline
Some checks are pending
jacoco-coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 50.00% (2/4) * Lines of Code: 4 * Cyclomatic Complexity: 3 #### Quality Gates Summary No active quality gates.
build
test-coverage
Jacoco Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 50.00% (2/4) * Lines of Code: 4 * Cyclomatic Complexity: 3 #### Quality Gates Summary Overall result: Success Output truncated.
Tests / Post passed: 1
2025-02-19 15:56:55 +00:00
260354a009 add withChecks into pipeline
Some checks failed
test-coverage / build occurred while executing withChecks step.
2025-02-19 15:53:23 +00:00
407bc6311c add withChecks into pipeline
Some checks are pending
test-coverage / build
JaCoCo Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 50.00% (2/4) * Lines of Code: 4 * Cyclomatic Complexity: 3 #### Quality Gates Summary No active quality gates.
2025-02-19 15:43:41 +00:00
39a361ec41 add withChecks into pipeline 2025-02-19 15:39:04 +00:00
9ec20b53e3 add withChecks into pipeline 2025-02-19 15:29:54 +00:00
a86ddef535 add withChecks into pipeline 2025-02-19 15:00:51 +00:00
b3e3a68736 add withChecks into pipeline 2025-02-19 14:38:25 +00:00
f26cfa6950 add withChecks into pipeline 2025-02-19 14:34:54 +00:00
4b57b3d45a add withChecks into pipeline 2025-02-19 14:28:27 +00:00
2 changed files with 78 additions and 33 deletions

63
Jenkinsfile vendored
View File

@ -2,21 +2,58 @@ pipeline {
agent any
stages {
stage('build') {
stage('Build') {
steps {
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'
withChecks(name: 'build', 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
"""
}
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
}
}

View File

@ -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.set(true)
csv.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()
// }
// }
// }
//}
application {
// Define the main class for the application.
mainClass.set("jenkins.test.App")