Compare commits

..

No commits in common. "4f783e4719e838c37492ac110641ea834ae72643" and "a86ddef535e0761d45818158cf3c7e3650728dec" have entirely different histories.

2 changed files with 48 additions and 65 deletions

57
Jenkinsfile vendored
View File

@ -2,45 +2,28 @@ pipeline {
agent any
stages {
stage('Build') {
stage('build') {
steps {
withChecks(name: 'Test', includeStage: true) {
withGradle {
sh """
./gradlew clean 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: 'INSTRUCTION', baseline: 'PROJECT', unstable: true],
[threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]])
junit testResults: '**/build/test-results/test/TEST-*.xml'
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'
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]]
)
}
}
} // Test
stage('Reports') {
steps {
script {
// 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]
}
}
} // Reports
}
}
}

View File

@ -37,36 +37,36 @@ jacoco {
toolVersion = "0.8.12"
}
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()
// }
// }
//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")