Skip to content

Commit

Permalink
chore: refactor running checks under Jenkins
Browse files Browse the repository at this point in the history
* run all lint checks even if some are failed
* try to run tests even if lint checks are failed

Closes #45

Partially solves #40
  • Loading branch information
grv87 committed Dec 1, 2018
1 parent 6d5a7d7 commit 5544399
Showing 1 changed file with 74 additions and 63 deletions.
137 changes: 74 additions & 63 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,70 +135,81 @@ node {
)
}
}
stage('Check') {
try {
timeout(time: 10, unit: 'MINUTES') {
buildInfo = rtGradle.run tasks: 'check', switches: gradleSwitches, buildInfo: buildInfo
try {
stage('Lint') {
try {
timeout(time: 5, unit: 'MINUTES') {
buildInfo = rtGradle.run tasks: 'lint', switches: "$gradleSwitches --continue".toString(), buildInfo: buildInfo
}
} finally {
publishHTML(target: [
reportName: 'CodeNarc',
reportDir: 'build/reports/html/codenarc',
reportFiles: [
'exceptions',
'main',
'mainResources',
'testFixtures',
'test',
'functionalTest',
'compatTest',
'buildSrc',
].collect { "${ it }.html" }.join(', '), // TODO: read from directory ?
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
}
}
} finally {
stage('Test') {
try {
timeout(time: 10, unit: 'MINUTES') {
buildInfo = rtGradle.run tasks: 'check', switches: gradleSwitches, buildInfo: buildInfo
}
} finally {
warnings(
consoleParsers: [
[parserName: 'Java Compiler (javac)'],
[parserName: 'JavaDoc Tool'],
]
)
junit(
testResults: 'build/reports/xml/**/*.xml',
allowEmptyResults: true,
keepLongStdio: true,
)
publishHTML(target: [
reportName: 'Test',
reportDir: 'build/reports/html/test',
reportFiles: 'index.html',
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
publishHTML(target: [
reportName: 'FunctionalTest',
reportDir: 'build/reports/html/functionalTest',
reportFiles: 'index.html',
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
publishHTML(target: [
reportName: 'CompatTest',
reportDir: 'build/reports/html/compatTest',
reportFiles:
readFile(file: '.stutter/java8.lock', encoding: 'UTF-8') // TODO: respect other Java versions
.split('[\r\n]+')
// Copy of algorithm from StutterExtension.getLockedVersions
.findAll { !it.startsWith('#') }
.collect { "${ it.trim() }/index.html" }
.join(', '),
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
}
} finally {
warnings(
consoleParsers: [
[parserName: 'Java Compiler (javac)'],
[parserName: 'JavaDoc Tool'],
]
)
publishHTML(target: [
reportName: 'CodeNarc',
reportDir: 'build/reports/html/codenarc',
reportFiles: [
'exceptions',
'main',
'mainResources',
'testFixtures',
'test',
'functionalTest',
'compatTest',
'buildSrc',
].collect { "${ it }.html" }.join(', '), // TODO: read from directory ?
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
junit(
testResults: 'build/reports/xml/**/*.xml',
allowEmptyResults: true,
keepLongStdio: true,
)
publishHTML(target: [
reportName: 'Test',
reportDir: 'build/reports/html/test',
reportFiles: 'index.html',
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
publishHTML(target: [
reportName: 'FunctionalTest',
reportDir: 'build/reports/html/functionalTest',
reportFiles: 'index.html',
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
publishHTML(target: [
reportName: 'CompatTest',
reportDir: 'build/reports/html/compatTest',
reportFiles:
readFile(file: '.stutter/java8.lock', encoding: 'UTF-8') // TODO: respect other Java versions
.split('[\r\n]+')
// Copy of algorithm from StutterExtension.getLockedVersions
.findAll { !it.startsWith('#') }
.collect { "${ it.trim() }/index.html" }
.join(', '),
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: env.BRANCH_NAME == 'develop' && !env.CHANGE_ID
])
}
}
stage('Release') {
Expand Down

0 comments on commit 5544399

Please sign in to comment.