This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
forked from TiForward/HAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
154 lines (147 loc) · 5.11 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
#!groovy
def cmakeAndMSBuild(buildDir, buildType, platform, sdkVersion, args) {
def generator = 'Visual Studio 12 2013'
def msBuildArgs = ''
if (platform.equals('ARM')) {
generator += ' ARM'
msBuildArgs = '/p:Platform=ARM'
}
// Clean the build directory
if (fileExists("build/${buildDir}")) {
dir("build/${buildDir}") {
deleteDir()
}
}
bat "mkdir build\\${buildDir}"
def msBuild12 = tool(name: 'MSBuild 12.0', type: 'hudson.plugins.msbuild.MsBuildInstallation')
def raw = bat(returnStdout: true, script: "echo %JavaScriptCore_${sdkVersion}_HOME%").trim()
def jscHome = raw.split('\n')[-1]
echo "Setting JavaScriptCore_HOME to ${jscHome}"
withEnv(["JavaScriptCore_HOME=${jscHome}"]) {
// Run CMake
dir("build/${buildDir}") {
bat "cmake -G \"${generator}\" -D CMAKE_BUILD_TYPE=${buildType} ${args} ${env.WORKSPACE}"
}
// Then MSBuild
bat "\"${msBuild12}\" /p:Configuration=${buildType} build/${buildDir}/HAL.sln ${msBuildArgs}"
}
// scan for warninsg from MSBuild
warnings consoleParsers: [[parserName: 'MSBuild']]
}
def test() {
// Run CTest
dir('build/testing') {
bat '(robocopy Debug examples\\Debug HAL.dll) ^& IF %ERRORLEVEL% LEQ 3 exit /B 0'
bat '(robocopy Debug test\\Debug HAL.dll) ^& IF %ERRORLEVEL% LEQ 3 exit /B 0'
bat 'ctest.exe --no-compress-output -T Test || verify > NUL'
}
step([$class: 'XUnitPublisher',
testTimeMargin: '3000',
thresholdMode: 1,
thresholds: [
[$class: 'FailedThreshold', failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0', unstableThreshold: '0'],
[$class: 'SkippedThreshold', failureNewThreshold: '0', failureThreshold: '0', unstableNewThreshold: '0', unstableThreshold: '0']
],
tools: [
[$class: 'CTestType', deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/testing/Testing/**/Test.xml', skipNoTestFiles: false, stopProcessingIfError: true]
]
])
}
// Wrap in timestamper
timestamps {
stage('Build') {
parallel(
'Win 8.1 Phone x86': {
node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
try {
checkout scm
cmakeAndMSBuild('x86', 'Release', 'x86', '8.1', '-DHAL_DISABLE_TESTS=ON -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
stash includes: 'build/x86/Release/HAL.*', name: '8.1-x86'
stash includes: 'build/x86/hal_export.h', name: 'export-header'
stash includes: 'include/**/*.hpp', name: 'headers'
} finally {
deleteDir()
}
}
},
'Win 8.1 Phone ARM': {
node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
try {
checkout scm
cmakeAndMSBuild('ARM', 'Release', 'ARM', '8.1', '-DHAL_DISABLE_TESTS=ON -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
stash includes: 'build/ARM/Release/HAL.*', name: '8.1-ARM'
} finally {
deleteDir()
}
}
}
// TODO: Windows 10
// 'Win 10 Phone x86': {
// node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
// checkout scm
// cmakeAndMSBuild('ARM', 'Release', 'ARM', '8.1', '-DHAL_DISABLE_TESTS=ON -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
// }
// },
// 'Windows 10 Desktop': {
// node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
// checkout scm
// cmakeAndMSBuild('ARM', 'Release', 'ARM', '8.1', '-DHAL_DISABLE_TESTS=ON -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
// // stash results!
// }
// }
)
} // stage('Build')
stage('Test') {
parallel(
'Win 8.1 Phone x86': {
node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
try {
checkout scm
cmakeAndMSBuild('testing', 'Debug', 'x86', '8.1', '-DHAL_DISABLE_TESTS=OFF -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
test()
} finally {
deleteDir()
}
}
// TODO: Windows 10
// 'Windows 10 Phone': {
// node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
// checkout scm
// cmakeAndMSBuild('testing', 'Debug', 'x86', '8.1', '-DHAL_DISABLE_TESTS=OFF -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
// test()
// }
// },
// 'Windows 10 Desktop': {
// node('msbuild-12 && jsc && cmake && gtest && boost && windows-sdk-8.1') {
// checkout scm
// cmakeAndMSBuild('testing', 'Debug', 'x86', '8.1', '-DHAL_DISABLE_TESTS=OFF -DHAL_DEFINE_JSCLASSDEFINITIONEMPTY=OFF')
// test()
// }
}
)
} // stage('Test')
stage('Results') {
node('windows') {
try {
// Clean the distribution directory
if (fileExists('dist/HAL')) {
dir('dist/HAL') {
deleteDir()
}
}
unstash 'headers'
unstash 'export-header'
unstash '8.1-ARM'
unstash '8.1-x86'
bat 'mkdir dist\\HAL'
bat '(robocopy build\\x86\\Release dist\\HAL\\x86 HAL.*) ^& IF %ERRORLEVEL% LEQ 3 exit /B 0'
bat '(robocopy build\\ARM\\Release dist\\HAL\\ARM HAL.*) ^& IF %ERRORLEVEL% LEQ 3 exit /B 0'
bat '(robocopy include dist\\HAL\\include *.hpp /e) ^& IF %ERRORLEVEL% LEQ 3 exit /B 0'
bat '(robocopy build\\x86 dist\\HAL\\include hal_export.h) ^& IF %ERRORLEVEL% LEQ 3 exit /B 0'
archiveArtifacts artifacts: 'dist/**/*'
} finally {
deleteDir()
}
} // node('windows')
} // stage('Results')
}