-
Notifications
You must be signed in to change notification settings - Fork 22
/
Jenkinsfile
298 lines (292 loc) · 14.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
@Library('[email protected]') _
getApproval()
pipeline {
agent none
options {
disableConcurrentBuilds()
skipDefaultCheckout()
timestamps()
// on develop discard builds after a certain number else keep forever
buildDiscarder(xmosDiscardBuildSettings())
}
parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.3.0',
description: 'The XTC tools version'
)
string(
name: 'XMOSDOC_VERSION',
defaultValue: 'v6.2.0',
description: 'The xmosdoc version'
)
booleanParam(name: 'NIGHTLY_TEST_ONLY',
defaultValue: false,
description: 'Tests that only run during nightly builds.'
)
} // parameters
environment {
REPO = 'sln_voice'
VIEW = getViewName(REPO)
VENV_DIRNAME = ".venv"
BUILD_DIRNAME = "dist"
VRD_TEST_RIG_TARGET = "XCORE-AI-EXPLORER"
PIPELINE_TEST_VECTORS = "pipeline_test_vectors"
ASR_TEST_VECTORS = "asr_test_vectors"
}
stages {
stage('Build and Docs') {
parallel {
stage('Build and Test') {
when {
expression { !env.GH_LABEL_DOC_ONLY.toBoolean() }
}
agent {
label 'xcore.ai && vrd'
}
stages {
stage('Checkout') {
steps {
checkout scm
sh 'git submodule update --init --recursive --depth 1 --jobs \$(nproc)'
}
}
stage('Build tests') {
steps {
createVenv(reqFile: "requirements.txt")
withTools(params.TOOLS_VERSION) {
withVenv {
// host apps
sh "tools/ci/build_host_apps.sh"
// test firmware and filesystems
sh "tools/ci/build_tests.sh"
// List built files for log
sh "ls -la dist_host/"
sh "ls -la dist/"
} // venv
} // tools
}
}
stage('ASRC Unit tests') {
steps {
withTools(params.TOOLS_VERSION) {
// tools/ci/build_tests.sh does not build for x86
sh "mkdir -p build_x86"
sh "cmake -B build_x86 -DXCORE_VOICE_TESTS=ON"
sh "cmake --build build_x86 --target test_asrc_div -j8"
// x86 build
sh "./build_x86/test_asrc_div"
// xcore build
sh "xsim dist/test_asrc_div.xe"
}
}
}
stage('ASRC Simulator') {
steps {
withTools(params.TOOLS_VERSION) {
dir("test/asrc_sim") {
createVenv('requirements.txt')
withVenv {
sh "pip install -r ./requirements.txt"
sh './run.sh'
}
}
}
}
}
stage('Install test requirements') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
// Install dependencies
withVenv() {
sh "pip install git+https://github0.xmos.com/xmos-int/xtagctl.git"
sh "pip install -r test/requirements.txt"
}
}
}
stage('Cleanup xtagctl') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
// Cleanup any xtagctl cruft from previous failed runs
withTools(params.TOOLS_VERSION) {
withVenv {
sh "xtagctl reset_all $VRD_TEST_RIG_TARGET"
}
}
sh "rm -f ~/.xtag/status.lock ~/.xtag/acquired"
}
}
stage('Run Sample Rate Conversion test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$VRD_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/sample_rate_conversion/check_sample_rate_conversion.sh " + adapterIDs[0]
}
sh "pytest test/sample_rate_conversion/test_sample_rate_conversion.py --wav_file test/sample_rate_conversion/test_output/sample_rate_conversion_output.wav --wav_duration 10"
}
}
}
}
}
stage('Run GPIO test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
sh "test/ffd_gpio/run_tests.sh"
sh 'python tools/ci/python/parse_test_output.py testing/test.rpt -outfile="testing/test_results" --print_test_results --verbose'
}
}
}
}
}
stage('Run FFD Low Power Audio Buffer test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
sh "test/ffd_low_power_audio_buffer/run_tests.sh"
sh "pytest test/ffd_low_power_audio_buffer/test_verify_low_power_audio_buffer.py"
}
}
}
}
}
stage('Run Device Firmware Update test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$VRD_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/device_firmware_update/check_dfu.sh " + adapterIDs[0]
}
sh "pytest test/device_firmware_update/test_dfu.py --readback_image test/device_firmware_update/test_output/readback_upgrade.bin --upgrade_image test/device_firmware_update/test_output/test_ffva_dfu_upgrade.bin"
}
}
}
}
}
stage('Checkout Amazon WWE') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
sh 'git clone [email protected]:xmos/amazon_wwe.git'
}
}
stage('Setup test vectors') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
sh "cp -r /projects/hydra_audio/xcore-voice_xvf3510_no_processing_xmos_test_suite_subset $PIPELINE_TEST_VECTORS"
sh "ls -la $PIPELINE_TEST_VECTORS"
sh "cp -r /projects/hydra_audio/xcore-voice_no_processing_ffd_test_suite $ASR_TEST_VECTORS"
sh "ls -la $ASR_TEST_VECTORS"
}
}
stage('Run FFVA Pipeline test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
sh "xtagctl reset_all $VRD_TEST_RIG_TARGET"
withXTAG(["$VRD_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/pipeline/check_pipeline.sh $BUILD_DIRNAME/test_pipeline_ffva_adec_altarch.xe $PIPELINE_TEST_VECTORS test/pipeline/ffva_quick.txt test/pipeline/ffva_test_output $WORKSPACE/amazon_wwe " + adapterIDs[0]
}
sh "pytest test/pipeline/test_pipeline.py --log test/pipeline/ffva_test_output/results.csv"
}
}
}
}
}
stage('Run FFD Pipeline test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
sh "xtagctl reset_all $VRD_TEST_RIG_TARGET"
script {
withXTAG(["$VRD_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/pipeline/check_pipeline.sh $BUILD_DIRNAME/test_pipeline_ffd.xe $PIPELINE_TEST_VECTORS test/pipeline/ffd_quick.txt test/pipeline/ffd_test_output $WORKSPACE/amazon_wwe " + adapterIDs[0]
}
sh "pytest test/pipeline/test_pipeline.py --log test/pipeline/ffd_test_output/results.csv"
}
}
}
}
}
stage('Run ASR test') {
when {
expression { params.NIGHTLY_TEST_ONLY == true }
}
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
sh "xtagctl reset_all $VRD_TEST_RIG_TARGET"
withXTAG(["$VRD_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/asr/check_asr.sh Sensory $ASR_TEST_VECTORS test/asr/ffd_quick_sensory.txt test/asr/sensory_output " + adapterIDs[0]
sh "test/asr/check_asr.sh Cyberon $ASR_TEST_VECTORS test/asr/ffd_quick_cyberon.txt test/asr/cyberon_output " + adapterIDs[0]
}
sh "pytest test/asr/test_asr.py --log test/asr/sensory_output/results.csv"
sh "pytest test/asr/test_asr.py --log test/asr/cyberon_output/results.csv"
}
}
}
}
}
}
post {
cleanup {
// xcoreCleanSandbox removes all output and artifacts of the Jenkins pipeline
// Comment out this post section to leave the workspace which can be useful for running items on the Jenkins agent.
// However, beware that this pipeline will not run if the workspace is not manually cleaned.
xcoreCleanSandbox()
}
}
}
stage('Build Documentation') {
agent {
label 'documentation&&docker'
}
steps {
checkout scm
sh 'git submodule update --init --recursive --depth 1 --jobs \$(nproc)'
warnError("Docs") {
buildDocs(archiveZipOnly: true)
} // warnError("Docs")
} // steps
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage('Build Documentation')
}
}
}
}