Compare commits

..

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

2 changed files with 48 additions and 65 deletions

59
Jenkinsfile vendored
View File

@ -2,45 +2,28 @@ pipeline {
agent any agent any
stages { stages {
stage('Build') { stage('build') {
steps { steps {
withChecks(name: 'Test', includeStage: true) { withChecks(name: 'build', includeStage: true) {
withGradle { sh './gradlew clean testClasses'
sh """ }
./gradlew clean test jacocoTestReport jacocoTestCoverageVerification --no-daemon withChecks(name: 'unit-tests', includeStage: true) {
""" sh './gradlew test'
} }
recordCoverage(tools: [[parser: 'JACOCO', pattern: '**/build/reports/jacoco/test/jacoco*.xml']], withChecks(name: 'test-coverage', includeStage: true) {
id: 'jacoco', sh './gradlew jacocoTestReport jacocoTestCoverageVerification'
name: 'JaCoCo Coverage', junit '**/build/test-results/test/TEST-*.xml'
sourceCodeRetention: 'EVERY_BUILD', recordCoverage(tools: [[parser: 'JACOCO']],
qualityGates: [ id: 'jacoco', name: 'JaCoCo Coverage',
[threshold: 40.0, metric: 'CLASS', baseline: 'PROJECT', unstable: true], sourceCodeRetention: 'EVERY_BUILD'
[threshold: 40.0, metric: 'METHOD', baseline: 'PROJECT', unstable: true], // , qualityGates: [
[threshold: 40.0, metric: 'LINE', 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]]
[threshold: 40.0, metric: 'BRANCH', baseline: 'PROJECT', unstable: true]]) )
junit testResults: '**/build/test-results/test/TEST-*.xml'
} }
} }
} // 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" toolVersion = "0.8.12"
} }
tasks.jacocoTestReport { //tasks.jacocoTestReport {
reports { // reports {
xml.required.set(true) // xml.required = true
csv.required.set(false) // csv.required = false
html.required.set(true) // html.required = 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.4".toBigDecimal()
}
}
rule {
isEnabled = true
element = "CLASS"
includes = listOf("jenkins.test.*")
limit {
counter = "LINE"
value = "TOTALCOUNT"
minimum = "0.3".toBigDecimal()
}
}
}
}
application { application {
// Define the main class for the application. // Define the main class for the application.
mainClass.set("jenkins.test.App") mainClass.set("jenkins.test.App")