-
Notifications
You must be signed in to change notification settings - Fork 3
/
ci.jsonnet
395 lines (355 loc) · 12.7 KB
/
ci.jsonnet
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
local defs = import "defs.jsonnet";
# https://github.com/graalvm/labs-openjdk-15/blob/master/doc/testing.md
local run_test_spec = "test/hotspot/jtreg/compiler/jvmci";
local labsjdk_builder_version = "eb99e407b1f5c5698f3074a2bd528371646ce890";
{
overlay: "509baaf0d06e0fd662ba236954bacf62c6676360",
specVersion: "2",
OSBase:: {
path(unixpath):: unixpath,
exe(unixpath):: unixpath,
jdk_home(java_home):: self.path(java_home),
java_home(jdk_home):: self.path(jdk_home),
copydir(src, dst):: ["cp", "-r", src, dst],
environment+: {
JIB_PATH: "${PATH}",
MAKE : "make",
ZLIB_BUNDLING: "system",
},
},
Windows:: self.OSBase + {
path(unixpath):: std.strReplace(unixpath, "/", "\\"),
exe(unixpath):: self.path(unixpath) + ".exe",
# https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy
copydir(src, dst):: ["xcopy", self.path(src), self.path(dst), "/e", "/i", "/q"],
downloads+: {
CYGWIN: {name: "cygwin", version: "3.0.7", platformspecific: true},
},
packages : {
# devkit_platform_revisions in make/conf/jib-profiles.js
"devkit:VS2019-16.5.3+1" : "==0"
},
capabilities+: ["windows"],
name+: "-windows-cygwin",
os:: "windows",
environment+: {
JIB_PATH: "$CYGWIN\\bin;$PATH",
ZLIB_BUNDLING: "bundled"
},
},
Linux:: self.OSBase + {
capabilities+: ["linux"],
name+: "-linux",
os:: "linux",
},
LinuxDockerAArch64:: self.Linux {
docker: {
image: defs.linux_docker_image_aarch64
},
},
LinuxDockerAMD64Musl:: self.Linux {
docker: {
image: defs.linux_docker_image_amd64_musl
},
},
LinuxDevkitAMD64:: self.Linux {
packages : {
# devkit_platform_revisions in make/conf/jib-profiles.js
"devkit:gcc9.2.0-OL6.4+1" : "==0"
},
},
LinuxDevkitAARCH64:: self.Linux {
packages : {
# devkit_platform_revisions in make/conf/jib-profiles.js
"devkit:gcc9.2.0-OL7.6+1" : "==0"
},
},
Darwin:: self.OSBase + {
jdk_home(java_home):: java_home + "/../..",
java_home(jdk_home):: jdk_home + "/Contents/Home",
packages+: {
# No need to specify a "make" package as Mac OS X has make 3.81
# available once Xcode has been installed.
},
os:: "darwin",
environment+: {
ac_cv_func_basename_r: "no",
ac_cv_func_clock_getres: "no",
ac_cv_func_clock_gettime: "no",
ac_cv_func_clock_settime: "no",
ac_cv_func_dirname_r: "no",
ac_cv_func_getentropy: "no",
ac_cv_func_mkostemp: "no",
ac_cv_func_mkostemps: "no",
MACOSX_DEPLOYMENT_TARGET: "10.11"
},
name+: "-darwin",
capabilities+: ["darwin_mojave"] # JIB only works on the darwin_mojave slaves
},
AMD64:: {
capabilities+: ["amd64"],
name+: "-amd64",
},
AMD64Musl:: self.AMD64 + {
name+: "-musl",
},
AArch64:: {
capabilities+: ["aarch64"],
name+: "-aarch64",
},
Eclipse:: {
downloads+: {
ECLIPSE: {
name: "eclipse",
version: "4.14.0",
platformspecific: true
}
},
environment+: {
ECLIPSE_EXE: "$ECLIPSE/eclipse"
},
},
JDT:: {
downloads+: {
JDT: {
name: "ecj",
version: "4.14.0",
platformspecific: false
}
}
},
BootJDK:: {
downloads+: {
BOOT_JDK: {
name : "oraclejdk",
version : "15.0.1+6",
platformspecific: true
}
}
},
MuslBootJDK:: {
downloads+: {
BOOT_JDK: {
name: "openjdk",
version: "15.0.1-internal+0-musl",
platformspecific: true
}
}
},
JTReg:: {
downloads+: {
JT_HOME: {
name : "jtreg",
version : "4.2"
}
}
},
local setupJDKSources(conf) = {
run+: [
# To reduce load, the CI system does not fetch all tags so it must
# be done explicitly as `build_labsjdk.py` relies on it.
["git", "fetch", "--tags"],
] + (if conf.os == "windows" then [
# Need to fix line endings on Windows to satisfy cygwin
# https://stackoverflow.com/a/26408129
["set-export", "JDK_SRC_DIR", "${PWD}\\..\\jdk"],
["git", "clone", "--quiet", "-c", "core.autocrlf=input", "-c", "gc.auto=0", ".", "${JDK_SRC_DIR}"],
] else [
["set-export", "JDK_SRC_DIR", "${PWD}"],
]) + [
["set-export", "JDK_SUITE_DIR", "${JDK_SRC_DIR}"]
],
},
Build(conf, is_musl_build):: conf + setupJDKSources(conf) + (if is_musl_build then self.MuslBootJDK else self.BootJDK) + {
packages+: if !is_musl_build then {
# GR-19828
"00:pip:logilab-common ": "==1.4.4",
"01:pip:astroid" : "==1.1.0",
"pip:pylint" : "==1.1.0",
} else {},
name: "build-jdk" + conf.name,
timelimit: "1:50:00",
diskspace_required: "10G",
logs: ["*.log"],
targets: ["gate"],
local build_labsjdk(jdk_debug_level, java_home_env_var) = [
["set-export", java_home_env_var, conf.path("${PWD}/../%s-java-home" % jdk_debug_level)],
["python3", "-u", conf.path("${LABSJDK_BUILDER_DIR}/build_labsjdk.py"),
"--boot-jdk=${BOOT_JDK}",
"--clean-after-build",
"--ci-target=tmp",
"--jdk-debug-level=" + jdk_debug_level,
"--test=" + run_test_spec,
"--java-home-link-target=${%s}" % java_home_env_var,
"${JDK_SRC_DIR}"
],
[conf.exe("${%s}/bin/java" % java_home_env_var), "-version"]
],
run+: (if !is_musl_build then [
# Run some basic mx based sanity checks. This is mostly to ensure
# IDE support does not regress.
["set-export", "JAVA_HOME", "${BOOT_JDK}"],
["mx", "-p", "${JDK_SUITE_DIR}", "checkstyle"],
["mx", "-p", "${JDK_SUITE_DIR}", "eclipseinit"],
["mx", "-p", "${JDK_SUITE_DIR}", "canonicalizeprojects"],
] else []) + [
["set-export", "LABSJDK_BUILDER_DIR", conf.path("${PWD}/../labsjdk-builder")],
["git", "clone", "-c", "core.autocrlf=input", "-c", "gc.auto=0", defs.labsjdk_builder_url, "${LABSJDK_BUILDER_DIR}"],
["git", "-C", "${LABSJDK_BUILDER_DIR}", "checkout", labsjdk_builder_version],
# This restricts cygwin to be on the PATH only while using jib.
# It must not be on the PATH when building Graal.
["set-export", "OLD_PATH", "${PATH}"],
["set-export", "PATH", "${JIB_PATH}"],
["set-export", "JIB_DATA_DIR", conf.path("${PWD}/../jib")],
["set-export", "JIB_SERVER", defs.jib_server],
["set-export", "JIB_SERVER_MIRRORS", defs.jib_server_mirrors],
] +
build_labsjdk("release", "JAVA_HOME") +
build_labsjdk("fastdebug", "JAVA_HOME_FASTDEBUG") +
[
["set-export", "PATH", "${OLD_PATH}"],
# Prepare for publishing
["set-export", "JDK_HOME", conf.path("${PWD}/jdk_home")],
["cd", "${JAVA_HOME}"],
conf.copydir(conf.jdk_home("."), "${JDK_HOME}")
],
publishArtifacts+: if !is_musl_build then [
{
name: "labsjdk" + conf.name,
dir: ".",
patterns: ["jdk_home"]
}
] else [
# In contrast to the labsjdk-builder repo, the gate in this repo
# does not bundle the musl static library into the main JDK. That is
# why the musl static library builder does not publish anything.
# The musl-based builder in this repo exists solely to ensure
# the musl build does not regress.
],
},
# Downstream Graal branch to test against.
local downstream_branch = "master",
local clone_graal = {
run+: [
["git", "clone", ["mx", "urlrewrite", "https://github.com/graalvm/graal.git"]],
["git", "-C", "graal", "checkout", downstream_branch, "||", "true"],
]
},
local requireLabsJDK(conf) = {
requireArtifacts+: [
{
name: "labsjdk" + conf.name,
dir: "."
}
],
run+: [
["set-export", "JAVA_HOME", conf.java_home("${PWD}/jdk_home")]
]
},
CompilerTests(conf):: conf + clone_graal + requireLabsJDK(conf) + {
name: "test-compiler" + conf.name,
timelimit: "1:00:00",
logs: ["*.log"],
targets: ["gate"],
run+: [
["mx", "-p", "graal/compiler", "gate", "--tags", "build,test,bootstraplite"]
]
},
# Build and test JavaScript on GraalVM
JavaScriptTests(conf):: conf + clone_graal + requireLabsJDK(conf) + {
local jsvm = ["mx", "-p", "graal/vm",
"--dynamicimports", "/graal-js,/substratevm",
"--components=Graal.js,Native Image",
"--native-images=js"],
name: "test-js" + conf.name,
timelimit: "1:00:00",
logs: ["*.log"],
targets: ["gate"],
run+: [
# Build and test JavaScript on GraalVM
jsvm + ["build"],
["set-export", "GRAALVM_HOME", jsvm + ["graalvm-home"]],
["${GRAALVM_HOME}/bin/js", "test/nashorn/opt/add.js"],
] +
if conf.os != "windows" then [
# Native launchers do not yet support --jvm mode on Windows
["${GRAALVM_HOME}/bin/js", "--jvm", "test/nashorn/opt/add.js"]
] else []
},
# Build LibGraal
BuildLibGraal(conf):: conf + clone_graal + requireLabsJDK(conf) + {
name: "build-libgraal" + conf.name,
timelimit: "1:00:00",
logs: ["*.log"],
targets: ["gate"],
publishArtifacts: [
{
name: "libgraal" + conf.name,
dir: ".",
patterns: ["graal/*/mxbuild"]
}
],
run+: [
["mx", "-p", "graal/vm", "--env", "libgraal",
"--extra-image-builder-argument=-J-esa",
"--extra-image-builder-argument=-H:+ReportExceptionStackTraces", "build"],
]
},
local requireLibGraal(conf) = {
requireArtifacts+: [
{
name: "libgraal" + conf.name,
dir: ".",
autoExtract: false
}
],
},
# Test LibGraal
TestLibGraal(conf):: conf + clone_graal + requireLabsJDK(conf) + requireLibGraal(conf) {
name: "test-libgraal" + conf.name,
timelimit: "1:00:00",
logs: ["*.log"],
targets: ["gate"],
run+: [
["unpack-artifact", "libgraal" + conf.name],
["mx", "-p", "graal/vm",
"--env", "libgraal",
"gate", "--task", "LibGraal"],
]
},
# Run LabsJDK
RunJDK(conf):: conf + requireLabsJDK(conf) {
name: "run-jdk" + conf.name,
logs: ["*.log"],
targets: ["gate"],
run+: [
[conf.exe("${JAVA_HOME}/bin/java"), "-version"],
]
},
local build_confs = [
self.LinuxDevkitAMD64 + self.AMD64,
self.LinuxDevkitAARCH64 + self.AArch64,
self.Darwin + self.AMD64,
self.Windows + self.AMD64
],
local graal_confs = [
self.LinuxDevkitAMD64 + self.AMD64,
self.Darwin + self.AMD64,
# Cannot use devkit (GR-26071)
self.LinuxDockerAArch64 + self.AArch64,
],
local amd64_musl_confs = [
self.LinuxDockerAMD64Musl + self.AMD64Musl,
],
builds: [ self.Build(conf, is_musl_build=false) for conf in build_confs ] +
[ self.CompilerTests(conf) for conf in graal_confs ] +
# GR-25354
#[ self.JavaScriptTests(conf) for conf in graal_confs ] +
[ self.BuildLibGraal(conf) for conf in graal_confs ] +
[ self.TestLibGraal(conf) for conf in graal_confs ] +
[ self.Build(conf, is_musl_build=true) for conf in amd64_musl_confs ] +
# GR-20001 prevents reliable Graal testing on Windows
# but we want to "require" the JDK artifact so that it
# is uploaded.
[ self.RunJDK(self.Windows + self.AMD64) ]
}