forked from pharo-project/pharo-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
242 lines (196 loc) · 6.71 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
def isWindows(){
//If NODE_LABELS environment variable is null, we assume we are on master unix machine
if (env.NODE_LABELS == null) {
return false
}
return env.NODE_LABELS.toLowerCase().contains('windows')
}
def shell(params){
if(isWindows()) bat(params)
else sh(params)
}
def runInCygwin(command){
def c = """#!c:\\cygwin64\\bin\\bash --login
cd `cygpath \"$WORKSPACE\"`
set -ex
${command}
"""
echo("Executing: ${c}")
withEnv(["PHARO_CI_TESTING_ENVIRONMENT=true"]) {
return sh(c)
}
}
def buildGTKBundle(){
node("unix"){
cleanWs()
stage("build-GTK-bundle"){
def commitHash = checkout(scm).GIT_COMMIT
unstash name: "packages-windows-CoInterpreterWithQueueFFI"
def shortGitHash = commitHash.substring(0,8)
def gtkBundleName = "PharoVM-8.1.0-GTK-${shortGitHash}-win64-bin.zip"
dir("build"){
shell "wget http://files.pharo.org/vm/pharo-spur64/win/third-party/Gtk3.zip"
shell "unzip Gtk3.zip -d ./bundleGTK"
shell "unzip -n build/packages/PharoVM-*-win64-bin.zip -d ./bundleGTK"
dir("bundleGTK"){
shell "zip -r -9 ../${gtkBundleName} *"
}
stash includes: "${gtkBundleName}", name: "packages-windows-gtkBundle"
archiveArtifacts artifacts: "${gtkBundleName}"
if(!isPullRequest() && env.BRANCH_NAME == 'headless'){
sshagent (credentials: ['b5248b59-a193-4457-8459-e28e9eb29ed7']) {
sh "scp -o StrictHostKeyChecking=no \
${gtkBundleName} \
[email protected]:/home/pharoorgde/files/vm/pharo-spur64-headless/win/${gtkBundleName}"
sh "scp -o StrictHostKeyChecking=no \
${gtkBundleName} \
[email protected]:/home/pharoorgde/files/vm/pharo-spur64-headless/win/latest-win64-GTK.zip"
}
}
}
}
}
}
def runBuild(platform, configuration){
cleanWs()
stage("Checkout-${platform}"){
dir('repository') {
checkout scm
}
}
stage("Build-${platform}-${configuration}"){
if(isWindows()){
runInCygwin "mkdir build"
runInCygwin "cd build && cmake -DFLAVOUR=${configuration} ../repository"
runInCygwin "cd build && make install"
runInCygwin "cd build && make package"
}else{
cmakeBuild generator: "Unix Makefiles", cmakeArgs: "-DFLAVOUR=${configuration}", sourceDir: "repository", buildDir: "build", installation: "InSearchPath"
dir("build"){
shell "make install"
shell "make package"
}
}
stash excludes: '_CPack_Packages', includes: 'build/build/packages/*', name: "packages-${platform}-${configuration}"
archiveArtifacts artifacts: 'build/build/packages/*', excludes: '_CPack_Packages'
}
}
def runTests(platform, configuration, packages){
cleanWs()
stage("Tests-${platform}-${configuration}"){
def vmDir = ''
if(platform == 'osx'){
vmDir = 'mac'
}else{
if(platform == 'unix')
vmDir = 'linux'
else
vmDir = 'win'
}
unstash name: "packages-${platform}-${configuration}"
shell "mkdir runTests"
dir("runTests"){
shell "wget -O - get.pharo.org/64/80 | bash "
shell "echo 80 > pharo.version"
if(isWindows()){
runInCygwin "cd runTests && unzip ../build/build/packages/PharoVM-*-${vmDir}64-bin.zip -d ."
runInCygwin "PHARO_CI_TESTING_ENVIRONMENT=true cd runTests && ./PharoConsole.exe Pharo.image test --junit-xml-output --stage-name=win64-${configuration} '${packages}'"
}else{
shell "unzip ../build/build/packages/PharoVM-*-${vmDir}64-bin.zip -d ."
if(platform == 'osx'){
shell "PHARO_CI_TESTING_ENVIRONMENT=true ./Pharo.app/Contents/MacOS/Pharo Pharo.image test --junit-xml-output --stage-name=osx64-${configuration} '${packages}'"
}
if(platform == 'unix'){
shell "PHARO_CI_TESTING_ENVIRONMENT=true ./pharo Pharo.image test --junit-xml-output --stage-name=unix64-${configuration} '${packages}'"
}
}
junit allowEmptyResults: true, testResults: "*.xml"
}
archiveArtifacts artifacts: 'runTests/*.xml', excludes: '_CPack_Packages'
}
}
def upload(platform, configuration, vmDir) {
cleanWs()
unstash name: "packages-${platform}-${configuration}"
def expandedBinaryFileName = sh(returnStdout: true, script: "ls build/build/packages/PharoVM-*-${vmDir}64-bin.zip").trim()
def expandedHeadersFileName = sh(returnStdout: true, script: "ls build/build/packages/PharoVM-*-${vmDir}64-include.zip").trim()
sshagent (credentials: ['b5248b59-a193-4457-8459-e28e9eb29ed7']) {
sh "scp -o StrictHostKeyChecking=no \
${expandedBinaryFileName} \
[email protected]:/home/pharoorgde/files/vm/pharo-spur64-headless/${vmDir}"
sh "scp -o StrictHostKeyChecking=no \
${expandedHeadersFileName} \
[email protected]:/home/pharoorgde/files/vm/pharo-spur64-headless/${vmDir}/include"
sh "scp -o StrictHostKeyChecking=no \
${expandedBinaryFileName} \
[email protected]:/home/pharoorgde/files/vm/pharo-spur64-headless/${vmDir}/latest.zip"
sh "scp -o StrictHostKeyChecking=no \
${expandedHeadersFileName} \
[email protected]:/home/pharoorgde/files/vm/pharo-spur64-headless/${vmDir}/include/latest.zip"
}
}
def isPullRequest() {
return env.CHANGE_ID != null
}
def uploadPackages(){
node('unix'){
stage('Upload'){
if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
return;
}
if(env.BRANCH_NAME != 'headless'){
echo "[DO NO UPLOAD] In branch different that 'headless': ${env.BRANCH_NAME}";
return;
}
upload('osx', "CoInterpreterWithQueueFFI", 'mac')
upload('unix', "CoInterpreterWithQueueFFI",'linux')
upload('windows', "CoInterpreterWithQueueFFI", 'win')
}
}
}
try{
properties([disableConcurrentBuilds()])
def platforms = ['unix', 'osx', 'windows']
def builders = [:]
def tests = [:]
for (platf in platforms) {
// Need to bind the label variable before the closure - can't do 'for (label in labels)'
def platform = platf
builders[platform] = {
node(platform){
timeout(30){
runBuild(platform, "CoInterpreterWithQueueFFI")
}
}
}
tests[platform] = {
node(platform){
timeout(30){
runTests(platform, "CoInterpreterWithQueueFFI", ".*")
}
}
}
}
builders["StackVM"] = {
node('osx'){
timeout(30){
runBuild('osx', "StackVM")
}
}
}
tests["StackVM"] = {
node('osx'){
timeout(40){
runTests('osx', "StackVM", "Kernel.*")
}
}
}
parallel builders
uploadPackages()
buildGTKBundle()
parallel tests
} catch (e) {
throw e
}