forked from scala-js/scala-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
588 lines (551 loc) · 26.9 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
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
// If not a PR, this is a long-lived branch, which should have a nightly build
def triggers = []
if (!env.CHANGE_ID) {
// This is the 1.x series: run nightly from Sunday to Friday
triggers << cron('H H(0-2) * * 0-5')
}
// Setup properties of this job definition
properties([
parameters([
string(name: 'matrix', defaultValue: 'auto', description: 'The matrix to build (auto, quick, full)')
]),
pipelineTriggers(triggers)
])
// Check whether the job was started by a timer
// See https://hopstorawpointers.blogspot.ch/2016/10/performing-nightly-build-steps-with.html
@NonCPS
def isJobStartedByTimer() {
def startedByTimer = false
def buildCauses = currentBuild.rawBuild.getCauses()
for (buildCause in buildCauses) {
if (buildCause != null) {
def causeDescription = buildCause.getShortDescription()
echo "shortDescription: ${causeDescription}"
if (causeDescription.contains("Started by timer")) {
startedByTimer = true
}
}
}
return startedByTimer
}
def startedByTimer = isJobStartedByTimer()
// Auto-select a matrix if it was not explicitly specified
def selectedMatrix = params.matrix
if (selectedMatrix == 'auto') {
def reason = ''
if (env.CHANGE_ID) {
reason = "is a PR ${env.CHANGE_ID}"
selectedMatrix = 'quick'
} else {
reason = "is not a PR, startedByTimer = $startedByTimer"
if (startedByTimer) {
selectedMatrix = 'full'
} else {
selectedMatrix = 'quick'
}
}
echo("Auto-selected matrix: $selectedMatrix ($reason)")
} else {
echo("Explicit matrix: $selectedMatrix")
}
def CIScriptPrelude = '''
LOCAL_HOME="/localhome/jenkins"
LOC_SBT_BASE="$LOCAL_HOME/scala-js-sbt-homes"
LOC_SBT_BOOT="$LOC_SBT_BASE/sbt-boot"
LOC_IVY_HOME="$LOC_SBT_BASE/sbt-home"
LOC_CS_CACHE="$LOC_SBT_BASE/coursier/cache"
TEST_LOCAL_IVY_HOME="$(pwd)/.ivy2-test-local"
rm -rf $TEST_LOCAL_IVY_HOME
mkdir $TEST_LOCAL_IVY_HOME
ln -s "$LOC_IVY_HOME/cache" "$TEST_LOCAL_IVY_HOME/cache"
export SBT_OPTS="-J-Xmx5G -J-XX:MaxPermSize=512M -Dsbt.boot.directory=$LOC_SBT_BOOT -Dsbt.ivy.home=$TEST_LOCAL_IVY_HOME -Divy.home=$TEST_LOCAL_IVY_HOME -Dsbt.global.base=$LOC_SBT_BASE"
export COURSIER_CACHE="$LOC_CS_CACHE"
export NODE_PATH="$HOME/node_modules/"
# Define setJavaVersion
setJavaVersion() {
export JAVA_HOME=$HOME/apps/java-$1
export PATH=$JAVA_HOME/bin:$PATH
}
# Define sbtretry and sbtnoretry
sbtretry() {
local TIMEOUT=45m
echo "RUNNING timeout -k 5 $TIMEOUT sbt" "$@"
timeout -k 5 $TIMEOUT sbt $SBT_OPTS "$@"
local CODE=$?
if [ "$CODE" -eq 124 ]; then
echo "TIMEOUT after" $TIMEOUT
fi
if [ "$CODE" -ne 0 ]; then
echo "RETRYING timeout -k 5 $TIMEOUT sbt" "$@"
timeout -k 5 $TIMEOUT sbt $SBT_OPTS "$@"
CODE=$?
if [ "$CODE" -eq 124 ]; then
echo "TIMEOUT after" $TIMEOUT
fi
if [ "$CODE" -ne 0 ]; then
echo "FAILED TWICE"
echo "Command was: sbt" "$@"
return $CODE
fi
fi
}
sbtnoretry() {
echo "RUNNING sbt" "$@"
sbt $SBT_OPTS "$@"
CODE=$?
if [ "$CODE" -ne 0 ]; then
echo "FAILED"
echo "Command was: sbt" "$@"
return $CODE
fi
}
'''
def Tasks = [
"main": '''
setJavaVersion $java
npm install &&
sbtretry ++$scala helloworld$v/run &&
sbtretry 'set scalaJSStage in Global := FullOptStage' \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withPrettyPrint(true))' \
++$scala helloworld$v/run &&
sbtretry 'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withOptimizer(false))' \
++$scala helloworld$v/run &&
sbtretry 'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withSemantics(_.withAsInstanceOfs(CheckedBehavior.Unchecked)))' \
++$scala helloworld$v/run &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
helloworld$v/run &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
helloworld$v/run &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
helloworld$v/run &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
helloworld$v/run &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallModulesFor(List("helloworld"))))' \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
helloworld$v/run &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in helloworld.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
'set scalaJSStage in Global := FullOptStage' \
helloworld$v/run &&
sbtretry ++$scala testingExample$v/testHtmlJSDom &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in testingExample.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in testingExample.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
testingExample$v/testHtml &&
sbtretry 'set scalaJSStage in Global := FullOptStage' \
++$scala testingExample$v/testHtmlJSDom &&
sbtretry ++$scala testSuiteJVM$v/test testSuiteExJVM$v/test &&
sbtretry ++$scala testSuite$v/test &&
sbtretry ++$scala \
testSuite$v/saveForStabilityTest \
testSuite$v/checkStability \
testSuite$v/forceRelinkForStabilityTest \
testSuite$v/checkStability \
testSuite$v/clean \
testSuite$v/checkStability &&
sbtretry ++$scala testSuiteEx$v/test &&
sbtretry 'set scalaJSStage in Global := FullOptStage' \
++$scala testSuiteEx$v/test &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in testSuiteEx.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in testSuiteEx.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
testSuiteEx$v/test &&
sbtretry ++$scala testSuite$v/test:doc library$v/test compiler$v/test &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in reversi.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in reversi.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
reversi$v/fastLinkJS \
reversi$v/fullLinkJS &&
sbtretry ++$scala \
'set scalaJSLinkerConfig in reversi.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallModulesFor(List("reversi"))))' \
'set scalaJSLinkerConfig in reversi.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
reversi$v/fastLinkJS \
reversi$v/fullLinkJS &&
sbtretry ++$scala \
reversi$v/fastLinkJS \
reversi$v/fullLinkJS \
reversi$v/checksizes &&
sbtretry ++$scala javalibintf/compile:doc compiler$v/compile:doc library$v/compile:doc \
testInterface$v/compile:doc testBridge$v/compile:doc &&
sbtretry ++$scala headerCheck &&
sbtretry ++$scala partest$v/fetchScalaSource &&
sbtretry ++$scala \
javalibintf/mimaReportBinaryIssues \
library$v/mimaReportBinaryIssues \
testInterface$v/mimaReportBinaryIssues \
jUnitRuntime$v/mimaReportBinaryIssues
''',
"test-suite-default-esversion": '''
setJavaVersion $java
npm install &&
sbtretry ++$scala jUnitTestOutputsJVM$v/test jUnitTestOutputsJS$v/test testBridge$v/test \
'set scalaJSStage in Global := FullOptStage' jUnitTestOutputsJS$v/test testBridge$v/test &&
sbtretry ++$scala $testSuite$v/test $testSuite$v/testHtmlJSDom &&
sbtretry 'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test \
$testSuite$v/testHtmlJSDom &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withAllowBigIntsForLongs(true)))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withAllowBigIntsForLongs(true)).withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withAvoidLetsAndConsts(false).withAvoidClasses(false)))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withAvoidLetsAndConsts(false).withAvoidClasses(false)))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallModulesFor(List("org.scalajs.testsuite"))))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test
''',
"test-suite-custom-esversion-force-polyfills": '''
setJavaVersion $java
npm install &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set Seq(jsEnv in $testSuite.v$v := new NodeJSEnvForcePolyfills(ESVersion.$esVersion), MyScalaJSPlugin.wantSourceMaps in $testSuite.v$v := ("$esVersion" != "ES5_1"))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test
''',
"test-suite-custom-esversion": '''
setJavaVersion $java
npm install &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= makeCompliant' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= { _.withSemantics(_.withStrictFloats(false)) }' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion).withAllowBigIntsForLongs(true)))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion).withAllowBigIntsForLongs(true)).withOptimizer(false))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.CommonJSModule))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
++$scala $testSuite$v/test &&
sbtretry \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleSplitStyle(ModuleSplitStyle.SmallestModules))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
++$scala $testSuite$v/test &&
sbtretry 'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withESFeatures(_.withESVersion(ESVersion.$esVersion)))' \
'set scalaJSLinkerConfig in $testSuite.v$v ~= (_.withModuleKind(ModuleKind.ESModule))' \
'set scalaJSStage in Global := FullOptStage' \
++$scala $testSuite$v/test
''',
/* For the bootstrap tests to be able to call
* `testSuite/test:fastOptJS`, `scalaJSStage in testSuite` must be
* `FastOptStage`, even when `scalaJSStage in Global` is `FullOptStage`.
*/
"bootstrap": '''
setJavaVersion $java
npm install &&
sbtnoretry ++$scala linker$v/test &&
sbtnoretry linkerPrivateLibrary/test &&
sbtnoretry ++$scala irJS$v/test linkerJS$v/test linkerInterfaceJS$v/test &&
sbtnoretry 'set scalaJSStage in Global := FullOptStage' \
'set scalaJSStage in testSuite.v$v := FastOptStage' \
++$scala irJS$v/test linkerJS$v/test linkerInterfaceJS$v/test &&
sbtnoretry ++$scala testSuite$v/bootstrap:test &&
sbtnoretry 'set scalaJSStage in Global := FullOptStage' \
'set scalaJSStage in testSuite.v$v := FastOptStage' \
++$scala testSuite$v/bootstrap:test &&
sbtnoretry ++$scala irJS$v/mimaReportBinaryIssues \
linkerInterfaceJS$v/mimaReportBinaryIssues linkerJS$v/mimaReportBinaryIssues
''',
"tools": '''
setJavaVersion $java
npm install &&
sbtnoretry ++$scala ir$v/test linkerInterface$v/test \
linker$v/compile testAdapter$v/test \
ir$v/mimaReportBinaryIssues \
linkerInterface$v/mimaReportBinaryIssues linker$v/mimaReportBinaryIssues \
testAdapter$v/mimaReportBinaryIssues &&
sbtnoretry ++$scala ir$v/compile:doc \
linkerInterface$v/compile:doc linker$v/compile:doc \
testAdapter$v/compile:doc
''',
// These are agnostic to the Scala version
"sbt-plugin-and-scalastyle": '''
setJavaVersion $java
npm install &&
sbtnoretry \
sbtPlugin/compile:doc \
sbtPlugin/mimaReportBinaryIssues \
scalastyleCheck &&
sbtnoretry sbtPlugin/scripted
''',
"partest-noopt": '''
setJavaVersion $java
npm install &&
sbtnoretry ++$scala partestSuite$v/test:compile &&
sbtnoretry ++$scala "partestSuite$v/testOnly -- --showDiff"
''',
"partest-fastopt": '''
setJavaVersion $java
npm install &&
sbtnoretry ++$scala partestSuite$v/test:compile &&
sbtnoretry ++$scala "partestSuite$v/testOnly -- --fastOpt --showDiff"
''',
"partest-fullopt": '''
setJavaVersion $java
npm install &&
sbtnoretry ++$scala partestSuite$v/test:compile &&
sbtnoretry ++$scala "partestSuite$v/testOnly -- --fullOpt --showDiff"
''',
"scala3-compat": '''
setJavaVersion $java
npm install &&
sbtnoretry ++$scala! ir2_13/test
'''
]
def mainJavaVersion = "1.8"
def otherJavaVersions = ["11", "16"]
def allJavaVersions = otherJavaVersions.clone()
allJavaVersions << mainJavaVersion
def mainScalaVersion = "2.12.18"
def mainScalaVersions = ["2.12.18", "2.13.12"]
def otherScalaVersions = [
"2.12.2",
"2.12.3",
"2.12.5",
"2.12.6",
"2.12.7",
"2.12.8",
"2.12.9",
"2.12.10",
"2.12.11",
"2.12.12",
"2.12.13",
"2.12.14",
"2.12.15",
"2.12.16",
"2.12.17",
"2.13.0",
"2.13.1",
"2.13.2",
"2.13.3",
"2.13.4",
"2.13.5",
"2.13.6",
"2.13.7",
"2.13.8",
"2.13.9",
"2.13.10",
"2.13.11"
]
def scala3Version = "3.2.1"
def allESVersions = [
"ES5_1",
"ES2015",
// "ES2016", // Technically we have the '**' operator dependent on ES2016, but it's not enough to justify testing this version
"ES2017",
"ES2018",
// "ES2019", // We do not use anything specifically from ES2019
"ES2020",
"ES2021" // We do not use anything specifically from ES2021, but always test the latest to avoid #4675
]
// The 'quick' matrix
def quickMatrix = []
mainScalaVersions.each { scalaVersion ->
allJavaVersions.each { javaVersion ->
quickMatrix.add([task: "main", scala: scalaVersion, java: javaVersion])
quickMatrix.add([task: "tools", scala: scalaVersion, java: javaVersion])
}
quickMatrix.add([task: "test-suite-default-esversion", scala: scalaVersion, java: mainJavaVersion, testSuite: "testSuite"])
quickMatrix.add([task: "test-suite-custom-esversion", scala: scalaVersion, java: mainJavaVersion, esVersion: "ES5_1", testSuite: "testSuite"])
quickMatrix.add([task: "test-suite-default-esversion", scala: scalaVersion, java: mainJavaVersion, testSuite: "scalaTestSuite"])
quickMatrix.add([task: "test-suite-custom-esversion", scala: scalaVersion, java: mainJavaVersion, esVersion: "ES5_1", testSuite: "scalaTestSuite"])
quickMatrix.add([task: "bootstrap", scala: scalaVersion, java: mainJavaVersion])
quickMatrix.add([task: "partest-fastopt", scala: scalaVersion, java: mainJavaVersion])
}
allESVersions.each { esVersion ->
quickMatrix.add([task: "test-suite-custom-esversion-force-polyfills", scala: mainScalaVersion, java: mainJavaVersion, esVersion: esVersion, testSuite: "testSuite"])
}
allJavaVersions.each { javaVersion ->
// the `scala` version is irrelevant here
quickMatrix.add([task: "sbt-plugin-and-scalastyle", scala: mainScalaVersion, java: javaVersion])
}
quickMatrix.add([task: "scala3-compat", scala: scala3Version, java: mainJavaVersion])
// The 'full' matrix
def fullMatrix = quickMatrix.clone()
otherScalaVersions.each { scalaVersion ->
fullMatrix.add([task: "main", scala: scalaVersion, java: mainJavaVersion])
}
mainScalaVersions.each { scalaVersion ->
otherJavaVersions.each { javaVersion ->
quickMatrix.add([task: "test-suite-default-esversion", scala: scalaVersion, java: javaVersion, testSuite: "testSuite"])
}
fullMatrix.add([task: "partest-noopt", scala: scalaVersion, java: mainJavaVersion])
fullMatrix.add([task: "partest-fullopt", scala: scalaVersion, java: mainJavaVersion])
}
otherJavaVersions.each { javaVersion ->
fullMatrix.add([task: "scala3-compat", scala: scala3Version, java: javaVersion])
}
def Matrices = [
quick: quickMatrix,
full: fullMatrix
]
if (!Matrices.containsKey(selectedMatrix)) {
error("Nonexistent matrix '$selectedMatrix'")
}
def matrix = Matrices[selectedMatrix]
buildDefs = [:]
matrix.each { taskDef ->
def taskName = taskDef.task
if (!Tasks.containsKey(taskName)) {
error("Nonexistent task '$taskName'")
}
def taskStr = Tasks[taskName]
def fullTaskName = taskName
taskDef.each { name, value ->
if (name != 'task') {
taskStr = taskStr.replace('$' + name, value)
fullTaskName += " $name=$value"
}
}
def suffix = taskDef.scala.split('\\.')[0..1].join('_')
taskStr = taskStr.replace('$v', suffix)
def ciScript = CIScriptPrelude + taskStr
buildDefs.put(fullTaskName, {
node('linuxworker') {
checkout scm
retry(2) {
sh "git clean -fdx && rm -rf partest/fetchedSources/"
writeFile file: 'ciscript.sh', text: ciScript, encoding: 'UTF-8'
timeout(time: 4, unit: 'HOURS') {
sh "echo '$fullTaskName' && cat ciscript.sh && sh ciscript.sh"
}
}
}
})
}
ansiColor('xterm') {
stage('Test') {
parallel(buildDefs)
}
}