forked from tmtsoftware/esw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprod
119 lines (106 loc) · 3.77 KB
/
prod
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
pipeline {
agent {
label 'master'
}
options {
timeout(time: 2, unit: 'HOURS')
timestamps()
}
stages {
stage('Checkout') {
steps {
git '[email protected]:tmtsoftware/esw.git'
sh "git checkout $SHA"
}
}
stage('Build') {
steps {
sh "sbt scalafmtCheck"
sh "sbt clean makeSite"
sh "sbt ';set every Seq(enableFatalWarnings := true, scalafmtOnCompile := false); test:compile; multi-jvm:compile;'"
}
}
stage('Test') {
steps {
sh "sbt -DenableCoverage=true -DgenerateStoryReport=true test:test"
sh "sbt -DenableCoverage=true esw-ocs-dsl-kt/test" // fixme: test reporter does not work
sh "sbt -DenableCoverage=true 'esw-test-reporter/run ../target/RTM/testStoryMapping.txt ../tools/RTM/storyRequirementMapping.csv ../target/RTM/testRequirementsMapping.txt'"
}
post {
always {
sh "sbt -DenableCoverage=true coverageReport"
sh "sbt coverageAggregate"
junit testResults: '**/target/test-reports/*.xml', allowEmptyResults: true
publishHTML(target: [
allowMissing : true,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : './target/scala-2.13/scoverage-report',
reportFiles : 'index.html',
reportName : "Scoverage Report"
])
publishHTML(target: [
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : './target/RTM/',
reportFiles : 'index.html',
reportName : "Test-Story-Requirement mapping"
])
sh "rm -rf esw-gateway/esw-gateway-api/.js/target esw-ocs/esw-ocs-api/.js/target"
}
}
}
stage('Multi-Jvm Test') {
steps {
sh "sbt esw-integration-test/multi-jvm:test"
}
}
stage('Git Tag') {
steps {
sh "git tag v$VERSION"
sh "git push origin v$VERSION"
}
}
stage('Github Release') {
steps {
sh "sbt -Dprod.publish=true githubRelease"
}
}
stage('Docs Publish') {
steps {
sh "sbt -Dprod.publish=true clean ghpagesPushSite"
}
}
}
post {
always {
script {
sendNotification(currentBuild.result)
}
}
}
}
def sendNotification(String buildStatus = 'STARTED') {
buildStatus = buildStatus ?: 'SUCCESS'
def colorCode = '#FF0000'
def subject = "${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
def summary = "${subject} (${env.BUILD_URL})"
def details = '${JELLY_SCRIPT,template="html"}'
// Override default values based on build status
if (buildStatus == 'STARTED') {
color = 'YELLOW'
colorCode = '#FFFF00'
} else if (buildStatus == 'SUCCESS') {
color = 'GREEN'
colorCode = '#00FF00'
} else {
color = 'RED'
colorCode = '#FF0000'
emailext(
subject: subject,
body: details,
to: "[email protected]"
)
}
slackSend(channel: "#esw-prod-release", color: colorCode, message: summary)
}