-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile
152 lines (138 loc) · 4.2 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
@Library('[email protected]')
def runningOn(machine) {
println "Stage running on:"
println machine
}
def buildApps(appList) {
appList.each { app ->
sh "cmake -G 'Unix Makefiles' -S ${app} -B ${app}/build"
sh "xmake -C ${app}/build -j\$(nproc)"
}
}
def checkSkipLink() {
def skip_linkcheck = ""
if (env.GH_LABEL_ALL.contains("skip_linkcheck")) {
println "skip_linkcheck set, skipping link check..."
skip_linkcheck = "clean html pdf"
}
return skip_linkcheck
}
def buildDocs(String zipFileName) {
withVenv {
sh 'pip install git+ssh://[email protected]/xmos/[email protected]'
sh "xmosdoc ${checkSkipLink()}"
zip zipFile: zipFileName, archive: true, dir: "doc/_build"
}
}
getApproval()
pipeline {
agent none
parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.2.1',
description: 'The XTC tools version'
)
} // parameters
options {
skipDefaultCheckout()
timestamps()
buildDiscarder(xmosDiscardBuildSettings(onlyArtifacts=false))
} // options
stages {
stage('Builds') {
parallel {
stage ('Build and Unit test') {
agent {
label 'xcore.ai'
}
stages {
stage ('Build') {
steps {
runningOn(env.NODE_NAME)
sh 'git clone -b develop [email protected]:xmos/xcommon_cmake'
sh 'git -C xcommon_cmake rev-parse HEAD'
dir('lib_camera') {
checkout scm
// build examples and tests
withTools(params.TOOLS_VERSION) {
withEnv(["XMOS_CMAKE_PATH=${WORKSPACE}/xcommon_cmake"]) {
buildApps([
"examples/take_picture_downsample",
"examples/take_picture_local",
"examples/take_picture_raw",
"tests/hardware_tests/test_timing",
"tests/unit_tests"
]) // buildApps
} // withEnv
} // withTools
} // dir
} // steps
} // Build
stage('Create Python enviroment') {
steps {
// Clone infrastructure repos
sh "git clone [email protected]:xmos/infr_apps"
sh "git clone [email protected]:xmos/infr_scripts_py"
// can't use createVenv on the top level yet
dir('lib_camera') {
createVenv('requirements.txt')
withVenv {
sh "pip install -e ../infr_scripts_py"
sh "pip install -e ../infr_apps"
}
}
}
} // Create Python enviroment
stage('Source check') {
steps {
// bit weird for now but should changed after the next xjsl release
dir('lib_camera') {
withVenv {
dir('tests/lib_checks') {
sh "pytest -s"
}
}
}
}
} // Source check
stage('Unit tests') {
steps {
dir('lib_camera/tests/unit_tests') {
withTools(params.TOOLS_VERSION) {
sh 'xrun --id 0 --xscope bin/test_camera.xe'
}
}
}
} // Unit tests
} // stages
post {
cleanup {
cleanWs()
}
}
} // Build and Unit test
stage ('Build Documentation') {
agent {
label 'documentation'
}
steps {
runningOn(env.NODE_NAME)
dir('lib_camera') {
checkout scm
createVenv("requirements.txt")
withTools(params.TOOLS_VERSION) {
buildDocs("lib_camera_docs.zip")
} // withTools
} // dir
} // steps
post {
cleanup {
cleanWs()
}
}
} // Build Documentation
} // parallel
} // Builds
} // stages
} // pipeline