forked from tinymce/tinymce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
100 lines (83 loc) · 2.89 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
properties([
disableConcurrentBuilds(),
pipelineTriggers([
upstream(threshold: 'SUCCESS', upstreamProjects:
'alloy, bridge'
),
pollSCM('H 0 1 1 1')
])
])
node("primary") {
stage ("Checkout SCM") {
checkout scm
sh "mkdir -p jenkins-plumbing"
dir ("jenkins-plumbing") {
git([branch: "tinymce-5.x", url:'ssh://git@stash:7999/van/jenkins-plumbing.git', credentialsId: '8aa93893-84cc-45fc-a029-a42f21197bb3'])
}
}
def extNpmInstall = load("jenkins-plumbing/npm-install.groovy")
def permutations = [
[ name: "win10Chrome", os: "windows-10", browser: "chrome" ]
,[ name: "win10FF", os: "windows-10", browser: "firefox" ]
,[ name: "win10Edge", os: "windows-10", browser: "MicrosoftEdge" ]
,[ name: "win10IE", os: "windows-10", browser: "ie" ]
,[ name: "macSafari", os: "macos", browser: "safari" ]
,[ name: "macChrome", os: "macos", browser: "chrome" ]
,[ name: "macFirefox", os: "macos", browser: "firefox" ]
]
def processes = [:]
for (int i = 0; i < permutations.size(); i++) {
def permutation = permutations.get(i);
def processName = permutation.name;
processes[processName] = {
stage (permutation.os + ' ' + permutation.browser) {
node("bedrock-" + permutation.os) {
echo "Slave checkout on node $NODE_NAME"
checkout scm
echo "Installing tools"
extNpmInstall()
if (isUnix()) {
sh "yarn grunt clean dev"
} else {
bat "yarn grunt clean dev"
}
echo "Platform: browser tests for " + permutation.name + " on node: $NODE_NAME"
def name = permutation.name
// Clean out the old XML files before running tests, since we junit import *.XML files
dir('scratch') {
if (isUnix()) {
sh "rm -f *.xml"
} else {
bat "del *.xml"
}
}
def bedrock = "yarn grunt bedrock-auto:standard --bedrock-browser=" + permutation.browser
def successfulTests = true
if (isUnix()) {
successfulTests = (sh([script: bedrock, returnStatus: true]) == 0) && successfulTests
} else {
successfulTests = (bat([script: bedrock, returnStatus: true]) == 0) && successfulTests
}
echo "Writing JUnit results for " + name + " on node: $NODE_NAME"
step([$class: 'JUnitResultArchiver', testResults: 'scratch/TEST-*.xml'])
if (!successfulTests) {
echo "Tests failed for " + name + " so passing failure as exit code for node: $NODE_NAME"
if (isUnix()) {
sh "exit 1"
} else {
bat "exit 1"
}
}
}
}
}
}
extNpmInstall()
// top level build only runs on linux
stage ("Type check") {
sh 'grunt shell:tsc tslint'
}
stage ("Run tests") {
parallel processes
}
}