-
Notifications
You must be signed in to change notification settings - Fork 547
/
Jenkinsfile
251 lines (239 loc) · 10.3 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
def DEFAULT_RUBY_VERSION = '3.1.6'
def LINUX_COMPILE_CONCURRENCY = 4
def LINUX_ENV = ["TEST_RUBY_VERSION=${DEFAULT_RUBY_VERSION}", "COMPILE_CONCURRENCY=${LINUX_COMPILE_CONCURRENCY}"]
def MACOS_COMPILE_CONCURRENCY = 4
def MACOS_ENV = ["TEST_RUBY_VERSION=${DEFAULT_RUBY_VERSION}", "COMPILE_CONCURRENCY=${MACOS_COMPILE_CONCURRENCY}"]
def setupTest(enablerFlag, nodeLabel, environment, block) {
if (enablerFlag) {
node(nodeLabel) {
withEnv(environment) {
block()
}
}
} else {
echo 'Test skipped.'
}
}
pipeline {
agent { node { label 'master-pipeline' } }
options {
buildDiscarder(logRotator(numToKeepStr: '15'))
timeout(time: 50, unit: 'MINUTES')
timestamps()
}
parameters {
// In alphabetical order so that the order matches
// how it is displayed in Blue Ocean.
booleanParam(name: 'APACHE2_LINUX', defaultValue: true, description: 'Apache 2 integration tests on Linux')
booleanParam(name: 'APACHE2_MACOS', defaultValue: true, description: 'Apache 2 integration tests on macOS')
booleanParam(name: 'CXX_LINUX_ROOT', defaultValue: true, description: 'C++ unit tests on Linux, as root')
booleanParam(name: 'CXX_LINUX', defaultValue: true, description: 'C++ unit tests on Linux, normal user')
booleanParam(name: 'CXX_MACOS', defaultValue: true, description: 'C++ unit tests on macOS')
booleanParam(name: 'NGINX_DYNAMIC_LINUX', defaultValue: true, description: 'Nginx dynamic module tests on Linux')
booleanParam(name: 'NGINX_DYNAMIC_MACOS', defaultValue: true, description: 'Nginx dynamic module tests on macOS')
booleanParam(name: 'NGINX_LINUX', defaultValue: true, description: 'Nginx integration tests on Linux')
booleanParam(name: 'NGINX_MACOS', defaultValue: true, description: 'Nginx integration tests on macOS')
booleanParam(name: 'NODEJS_LINUX', defaultValue: true, description: 'Node.js unit tests on Linux')
booleanParam(name: 'NODEJS_MACOS', defaultValue: true, description: 'Node.js unit tests on macOS')
booleanParam(name: 'STANDALONE_LINUX', defaultValue: true, description: 'Passenger Standalone integration tests on Linux')
booleanParam(name: 'STANDALONE_MACOS', defaultValue: true, description: 'Passenger Standalone integration tests on macOS')
booleanParam(name: 'RUBY_LINUX', defaultValue: true, description: 'Ruby unit tests on Linux')
booleanParam(name: 'RUBY_MACOS', defaultValue: true, description: 'Ruby unit tests on macOS')
booleanParam(name: 'HOMEBREW_PACKAGING', defaultValue: true, description: 'Homebrew packaging unit tests')
booleanParam(name: 'SOURCE_PACKAGING', defaultValue: true, description: 'Source packaging unit tests')
}
stages {
stage('Test') {
steps {
script {
parallel(
'Ruby unit tests on Linux': {
setupTest(params.RUBY_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker ruby'
} finally {
sh 'mv buildout/testlogs buildout/RUBY_LINUX'
archiveArtifacts artifacts: 'buildout/RUBY_LINUX/**'
}
}
},
'Ruby unit tests on macOS': {
setupTest(params.RUBY_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host ruby'
try {
sh './dev/ci/run-tests-natively ruby'
} finally {
sh 'mv buildout/testlogs buildout/RUBY_MACOS'
archiveArtifacts artifacts: 'buildout/RUBY_MACOS/**'
}
}
},
'Node.js unit tests on Linux': {
setupTest(params.NODEJS_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
sh './dev/ci/run-tests-with-docker nodejs'
}
},
'Node.js unit tests on macOS': {
setupTest(params.NODEJS_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host nodejs'
sh './dev/ci/run-tests-natively nodejs'
}
},
'C++ unit tests on Linux, normal user': {
setupTest(params.CXX_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker cxx'
} finally {
sh 'mv buildout/testlogs buildout/CXX_LINUX'
archiveArtifacts artifacts: 'buildout/CXX_LINUX/**'
}
}
},
'C++ unit tests on Linux, as root': {
setupTest(params.CXX_LINUX_ROOT, 'linux && amd64', LINUX_ENV + ['SUDO=1']) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker cxx'
} finally {
sh 'mv buildout/testlogs buildout/CXX_LINUX_ROOT'
archiveArtifacts artifacts: 'buildout/CXX_LINUX_ROOT/**'
}
}
},
'C++ unit tests on macOS': {
setupTest(params.CXX_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host cxx'
try {
sh './dev/ci/run-tests-natively cxx'
} finally {
sh 'mv buildout/testlogs buildout/CXX_MACOS'
archiveArtifacts artifacts: 'buildout/CXX_MACOS/**'
}
}
},
'Apache integration tests on Linux': {
setupTest(params.APACHE2_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker apache2'
} finally {
sh 'mv buildout/testlogs buildout/APACHE2_LINUX'
archiveArtifacts artifacts: 'buildout/APACHE2_LINUX/**'
}
}
},
'Apache integration tests on macOS': {
setupTest(params.APACHE2_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host apache2'
try {
sh './dev/ci/run-tests-natively apache2'
} finally {
sh 'mv buildout/testlogs buildout/APACHE2_MACOS'
archiveArtifacts artifacts: 'buildout/APACHE2_MACOS/**'
}
}
},
'Nginx integration tests on Linux': {
setupTest(params.NGINX_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker nginx'
} finally {
sh 'mv buildout/testlogs buildout/NGINX_LINUX'
archiveArtifacts artifacts: 'buildout/NGINX_LINUX/**'
}
}
},
'Nginx integration tests on macOS': {
setupTest(params.NGINX_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host nginx'
try {
sh './dev/ci/run-tests-natively nginx'
} finally {
sh 'mv buildout/testlogs buildout/NGINX_MACOS'
archiveArtifacts artifacts: 'buildout/NGINX_MACOS/**'
}
}
},
'Nginx dynamic module compatibility test on Linux': {
setupTest(params.NGINX_DYNAMIC_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker nginx-dynamic'
} finally {
sh 'mv buildout/testlogs buildout/NGINX_DYNAMIC_LINUX'
archiveArtifacts artifacts: 'buildout/NGINX_DYNAMIC_LINUX/**'
}
}
},
'Nginx dynamic module compatibility test on macOS': {
setupTest(params.NGINX_DYNAMIC_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host nginx-dynamic'
try {
sh './dev/ci/run-tests-natively nginx-dynamic'
} finally {
sh 'mv buildout/testlogs buildout/NGINX_DYNAMIC_MACOS'
archiveArtifacts artifacts: 'buildout/NGINX_DYNAMIC_MACOS/**'
}
}
},
'Passenger Standalone integration tests on Linux': {
setupTest(params.STANDALONE_LINUX, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
try {
sh './dev/ci/run-tests-with-docker standalone'
} finally {
sh 'mv buildout/testlogs buildout/STANDALONE_LINUX'
archiveArtifacts artifacts: 'buildout/STANDALONE_LINUX/**'
}
}
},
'Passenger Standalone integration tests on macOS': {
setupTest(params.STANDALONE_MACOS, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host standalone'
try {
sh './dev/ci/run-tests-natively standalone'
} finally {
sh 'mv buildout/testlogs buildout/STANDALONE_MACOS'
archiveArtifacts artifacts: 'buildout/STANDALONE_MACOS/**'
}
}
},
'Homebrew packaging unit tests': {
setupTest(params.HOMEBREW_PACKAGING, 'macos', MACOS_ENV) {
checkout scm
sh './dev/ci/setup-host homebrew-packaging'
sh './dev/ci/run-tests-natively homebrew-packaging'
}
},
'Source packaging unit tests': {
setupTest(params.SOURCE_PACKAGING, 'linux && amd64', LINUX_ENV) {
checkout scm
sh './dev/ci/setup-host'
sh './dev/ci/run-tests-with-docker source-packaging'
}
}
)
}
}
}
}
}