forked from DSLFoundry/mbeddr.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
106 lines (91 loc) · 2.31 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
node {
def jobName = env.JOB_NAME
def buildNumber = env.BUILD_NUMBER
def branchName = env.BRANCH_NAME
echo "Job: " + jobName
echo "Number: " + buildNumber
echo "Branch: " + branchName
def isNightlyJob = ~/.*NIGHTLY.*/
def isCbmcJob = ~/.*CBMC.*/
switch(jobName.toUpperCase()) {
case isCbmcJob :
echo "Running 'CBMC' target..."
stage 'Checkout'
node ('linux') {
checkoutMbeddr()
def cbmcLib = load 'cbmc.groovy'
if(cbmcLib == null) {
echo "Unable to load file 'cbmc.groovy'!"
} else {
cbmcLib.buildCBMC()
}
}
node ('mac') {
checkoutMbeddr()
def cbmcLib = load 'cbmc.groovy'
if(cbmcLib == null) {
echo "Unable to load file 'cbmc.groovy'!"
} else {
cbmcLib.buildCBMC()
}
}
node ('windows') {
checkoutMbeddr()
def cbmcLib = load 'cbmc.groovy'
if(cbmcLib == null) {
echo "Unable to load file 'cbmc.groovy'!"
} else {
cbmcLib.buildCBMC()
}
}
break;
case isNightlyJob:
echo "Running 'Nightly' target..."
stage 'Checkout'
node ('linux') {
checkoutMbeddr()
def nightlyLib = load 'nightly.groovy'
if(nightlyLib == null) {
echo "Unable to load file 'nightly.groovy'!"
} else {
nightlyLib.buildNightly()
}
}
break;
default:
echo "Running 'Default (mbeddr)' target..."
stage 'Checkout'
node ('linux') {
checkoutMbeddr()
def mbeddrLib = load 'mbeddr.groovy'
if(mbeddrLib == null) {
echo "Unable to load file 'mbeddr.groovy'!"
} else {
mbeddrLib.buildMbeddr()
}
}
break;
}
}
@NonCPS
def checkoutMbeddr() {
// Use a local reference git repo to speed up the checkout from GitHub
def reference = env.BSHARE
if(isUnix()) {
reference += "/gitcaches/reference/mbeddr.core/"
} else {
reference = "${BASE}\\workspace\\mbeddr_Reference_Repo\\mbeddr.core\\"
}
echo "Reference-Path: ${reference}"
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions + [
[$class: 'CloneOption', noTags: false, reference: reference, shallow: false],
[$class: 'CleanBeforeCheckout']],
gitTool: 'Local_Git',
submoduleCfg: [],
userRemoteConfigs: scm.userRemoteConfigs
])
}