-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathJenkinsfile.integration-variants
More file actions
137 lines (122 loc) · 4.32 KB
/
Copy pathJenkinsfile.integration-variants
File metadata and controls
137 lines (122 loc) · 4.32 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
pipeline {
// Don't set an agent, or it won't parallelize correctly.
// Each stage should ask for it's own agent
agent none
environment {
// Disable the daemon to prevent parallal issues
GRADLE_OPTS = '-Dci=true -Dfile.encoding=UTF-8 -Dselenium.wait.timeout=60 -Dorg.gradle.daemon=false'
}
tools {
jdk 'jdk_11_latest'
}
options {
timeout(time: 2, unit: 'HOURS')
skipStagesAfterUnstable()
}
stages {
stage('Integration Test Variants') {
parallel {
stage('Test: Prototype + RequireJS Disabled') {
agent {
node {
label 'ubuntu'
}
}
steps {
sh './gradlew tapestry-core:testWithPrototypeAndRequireJsDisabled --continue'
}
post {
always {
prefixAndPublishTestResults('testWithPrototypeAndRequireJsDisabled', 'Prototype')
}
}
}
stage('Test: jQuery + RequireJS Disabled') {
agent {
node {
label 'ubuntu'
}
}
steps {
sh './gradlew tapestry-core:testWithJqueryAndRequireJsDisabled --continue'
}
post {
always {
prefixAndPublishTestResults('testWithJqueryAndRequireJsDisabled', 'jQuery')
}
}
}
stage('Test: Prototype + RequireJS Enabled') {
agent {
node {
label 'ubuntu'
}
}
steps {
sh './gradlew tapestry-core:testWithPrototypeAndRequireJsEnabled --continue'
}
post {
always {
prefixAndPublishTestResults('testWithPrototypeAndRequireJsEnabled', 'PrototypeRjs')
}
}
}
}
}
}
post {
fixed { sendMail('FIXED') }
unstable { sendMail('UNSTABLE') }
failure { sendMail('FAILURE') }
aborted { sendMail('ABORTED') }
}
}
// TEST RESULTS
def prefixAndPublishTestResults(testName, prefix) {
sh """
if [ -d "tapestry-core/build/test-results/${testName}" ]; then
find tapestry-core/build/test-results/${testName} -name "*.xml" -type f -exec sed -i 's/classname="org[.]/classname="${prefix}.org./g' {} +
fi
"""
junit(
testResults: "tapestry-core/build/test-results/${testName}/**/*.xml",
allowEmptyResults: true
)
}
// MAIL NOTIFICATIONS
def getChangeLog() {
def changeSets = currentBuild.changeSets
if (changeSets.isEmpty()) {
return "No changes recorded (Manual build or no new commits)."
}
return changeSets
.collectMany { it.items as List }
.collect { "[${it.author}] ${it.msg}" }
.join('\n')
}
def sendMail(buildStatus) {
emailext (
subject: "[${buildStatus}] ${env.JOB_NAME} - Build #${env.BUILD_NUMBER}",
body: """
STATUS: ${buildStatus}
Build URL: ${env.BUILD_URL}
Duration: ${currentBuild.durationString.replace(' and counting', '')}
-----------------------------------------------------------
CHANGES
-----------------------------------------------------------
${getChangeLog()}
-----------------------------------------------------------
TEST RESULTS
-----------------------------------------------------------
\${TEST_COUNTS, var="total"} Tests: \${TEST_COUNTS, var="pass"} Passed, \${TEST_COUNTS, var="fail"} Failed, \${TEST_COUNTS, var="skip"} Skipped
-----------------------------------------------------------
FAILED TESTS (if any)
-----------------------------------------------------------
\${FAILED_TESTS, maxTests=10, showStack=false}
""",
recipientProviders: [
developers(), // People who have commits in this build
requestor() // The person who manually triggered the build
]
)
}