-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
63 lines (61 loc) · 2.73 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
pipeline {
agent {
node {
label 'local'
}
}
tools {
jdk 'JDK 8u162'
}
stages {
stage('Init') {
steps {
sh 'java -version'
checkout scm
sh 'git submodule update --init --recursive'
script {
def sbtHome = tool 'sbt 1.0.4'
env.sbt= "${sbtHome}/bin/sbt -no-colors -batch"
}
}
}
stage('Build & Test') {
steps {
sh "#!/bin/bash\n" +
"set -e -v -o pipefail\n" +
"${sbt} clean biopetTest | tee sbt.log"
junit 'target/test-reports/*.xml'
sh "#!/bin/bash\n" +
"set -e -v -o pipefail\n" +
"${sbt} 'set biopetEnableCodacyCoverage := false' 'set test in assembly := {}' assembly biopetTestReport | tee sbt.log"
sh "java -jar target/scala-2.11/*-assembly-*.jar -h" // Not possible for spark tools
sh 'n=`grep -ce "\\* com.github.biopet" sbt.log || true`; if [ "$n" -ne \"0\" ]; then echo "ERROR: Found conflicting dependencies inside biopet"; exit 1; fi'
sh "git diff --exit-code || (echo \"ERROR: Git changes detected, please regenerate the readme, create license headers and run scalafmt: sbt biopetGenerateReadme headerCreate scalafmt\" && exit 1)"
step([$class: 'ScoveragePublisher', reportDir: 'target/scala-2.11/scoverage-report/', reportFile: 'scoverage.xml'])
}
}
stage('Deploy') {
when {
branch 'develop'
}
steps {
sh "${sbt} publish ghpagesPushSite"
}
}
}
post {
failure {
slackSend(color: '#FF0000', message: "Failure: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
junit 'target/test-reports/*.xml'
}
unstable {
slackSend(color: '#FFCC00', message: "Unstable: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
aborted {
slackSend(color: '#7f7f7f', message: "Aborted: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
success {
slackSend(color: '#00FF00', message: "Success: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
}
}