-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathJenkinsfile
476 lines (421 loc) · 19.6 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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
// This file relates to internal XMOS infrastructure and should be ignored by external users
@Library('[email protected]') _
def checkout_shallow()
{
checkout scm: [
$class: 'GitSCM',
branches: scm.branches,
userRemoteConfigs: scm.userRemoteConfigs,
extensions: [[$class: 'CloneOption', depth: 1, shallow: true, noTags: false]]
]
}
// Get XCommon CMake.
// This is required for compiling a factory image for a DFU test using tools 15.2.1
// to test DFU across XTC tools versions.
def get_xcommon_cmake() {
sh "git clone -b v1.3.0 [email protected]:xmos/xcommon_cmake"
}
def clone_test_deps() {
dir("${WORKSPACE}") {
sh "git clone [email protected]:xmos-int/xtagctl"
sh "git -C xtagctl checkout v2.0.0"
sh "git clone [email protected]:xmos/hardware_test_tools"
sh "git -C hardware_test_tools checkout 2f9919c956f0083cdcecb765b47129d846948ed4"
}
}
def archiveSandbox(String repoName) {
sh "cp ${WORKSPACE}/${repoName}/build/manifest.txt ${WORKSPACE}"
sh "rm -rf .get_tools .venv"
sh "git -C ${repoName} clean -xdf -e '*.xe'"
zip zipFile: "${repoName}_sw.zip", archive: true, defaultExcludes: false
}
getApproval()
pipeline {
agent none
options {
skipDefaultCheckout()
timestamps()
buildDiscarder(xmosDiscardBuildSettings(onlyArtifacts=true))
}
parameters {
choice(name: 'TEST_LEVEL', choices: ['smoke', 'nightly', 'weekend'],
description: 'The level of test coverage to run')
string(
name: 'XMOSDOC_VERSION',
defaultValue: 'v6.2.0',
description: 'The xmosdoc version')
string(
name: 'INFR_APPS_VERSION',
defaultValue: 'v2.0.1',
description: 'The infr_apps version'
)
}
environment {
REPO = 'sw_usb_audio'
VIEW = getViewName(REPO)
TOOLS_VERSION = "15.3.0"
PREV_TOOLS_VERSION = "15.2.1"
}
stages {
stage('Build') {
parallel {
stage('(XCommon CMake) Build applications') {
// Use XCommon CMake to fetch dependencies and build all application configs
agent {
label 'linux && x86_64'
}
steps {
println "Stage running on ${env.NODE_NAME}"
get_xcommon_cmake()
dir("${REPO}") {
checkout_shallow()
withTools("${env.PREV_TOOLS_VERSION}") {
withEnv(["XMOS_CMAKE_PATH=${WORKSPACE}/xcommon_cmake"]) {
// Build one of the configs with old XTC tools (15.2.1) for a DFU test which tests if an older tools version factory executable
// can download an upgrade image built with the latest tools.
dir("app_usb_aud_xk_316_mc") {
sh "cmake -G 'Unix Makefiles' -B build_old_tools"
sh "xmake -C build_old_tools -j16 1SMi2o2xxxxxx"
// Create binary file using the old tools xflash that can be written into the device using xflash --write-all during the test
sh "xflash bin/1SMi2o2xxxxxx/app_usb_aud_xk_316_mc_1SMi2o2xxxxxx.xe -o bin/1SMi2o2xxxxxx/app_usb_aud_xk_316_mc_1SMi2o2xxxxxx.bin"
// Move to a different directory so it doesn't get overwritten when the same config is compiled with the latest tools
sh 'mv bin/1SMi2o2xxxxxx bin/1SMi2o2xxxxxx_old_tools'
sh 'for config in bin/1SMi2o2xxxxxx_old_tools/*.bin; do mv "$config" "${config/%.bin/_old_tools.bin}"; done'
sh 'for config in bin/1SMi2o2xxxxxx_old_tools/*.xe; do mv "$config" "${config/%.xe/_old_tools.xe}"; done'
sh 'rm -rf build_old_tools'
}
}
}
withTools("${env.TOOLS_VERSION}") {
clone_test_deps()
dir("tests") {
createVenv(reqFile: "requirements.txt")
withVenv() {
// Check that the app_configs_autogen.yml file is up to date
sh "python tools/app_configs_autogen/collect_configs.py check"
// Check that the BCD version in version.h matches the library version in settings.yml
sh "pytest -v test_version.py"
} // withVenv()
} // dir("tests")
// Build the loopback version of the configs for 316 and rename them to have _i2sloopback
sh "cmake -S app_usb_aud_xk_316_mc/ -B build -DPARTIAL_TESTED_CONFIGS=1 -DEXTRA_BUILD_FLAGS='-DI2S_LOOPBACK=1'"
sh "xmake -C build -j16"
sh 'for folder in app_usb_aud_xk_316_mc/bin/?*; do if [[ ! $folder == *"old_tools"* ]] ; then mv "$folder" "${folder/%/_i2sloopback}"; fi ; done'
sh 'for config in app_usb_aud_xk_316_mc/bin/?*/*.xe; do if [[ ! $config == *"old_tools"* ]] ; then mv "$config" "${config/%.xe/_i2sloopback.xe}"; fi ; done'
sh 'rm -rf build'
sh 'cmake -B build -DBUILD_TESTED_CONFIGS=1 -DTEST_SUPPORT_CONFIGS=1'
sh 'xmake -C build -j16'
stash includes: 'app_usb_aud_xk_316_mc/bin/**/*.xe, app_usb_aud_xk_316_mc/bin/**/*.bin', name: 'xk_316_mc_bin', useDefaultExcludes: false
stash includes: 'app_usb_aud_xk_216_mc/bin/**/*.xe', name: 'xk_216_mc_bin', useDefaultExcludes: false
stash includes: 'app_usb_aud_xk_evk_xu316/bin/**/*.xe', name: 'xk_evk_xu316_bin', useDefaultExcludes: false
archiveArtifacts artifacts: "app_usb_aud_*/bin/**/*.xe", excludes: "**/*_i2sloopback*" , fingerprint: true, allowEmptyArchive: false
archiveArtifacts artifacts: "build/manifest.txt", fingerprint: true, allowEmptyArchive: false
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
} // // (XCommon CMake) Build applications
stage('legacy xmake build + build documentation + Library checks') {
// Use XCommon CMake to fetch dependencies, but then build using legacy XCommon Makefiles
agent {
label 'linux && x86_64'
}
stages {
stage('legacy xmake build')
{
steps {
println "Stage running on ${env.NODE_NAME}"
dir("${REPO}") {
checkout_shallow()
withTools("${env.TOOLS_VERSION}") {
// Fetch all dependencies using XCommon CMake
sh "cmake -G 'Unix Makefiles' -B build -DDEPS_CLONE_SHALLOW=TRUE"
sh 'xmake -C app_usb_aud_xk_316_mc -j16'
sh 'xmake -C app_usb_aud_xk_216_mc -j16'
sh 'xmake -C app_usb_aud_xk_evk_xu316 -j16'
sh 'xmake -C app_usb_aud_xk_evk_xu316_extrai2s -j16'
}
}
} // steps
} // stage('legacy xmake build')
stage('Library checks') {
steps {
withTools("${env.TOOLS_VERSION}") {
warnError("libchecks") {
// Temp disable checks due to issue with changelog checker
//runSwrefChecks("${WORKSPACE}/${REPO}", "${params.INFR_APPS_VERSION}")
} // warnError("libchecks")
} // withTools("${env.TOOLS_VERSION}")
} // steps
} // stage('Library checks')
stage("Archive sandbox") {
steps
{
archiveSandbox(REPO)
}
} // stage("Archive sw")
stage('Build Documentation') {
steps {
clone_test_deps()
dir("${REPO}") {
dir("tests") {
createVenv(reqFile: "requirements.txt")
} // dir("tests")
withVenv(venv_path="${WORKSPACE}/${REPO}/tests") {
warnError("Docs") {
buildDocs(xmosdocVenvPath: "${REPO}/tests")
}
} // withVenv
} // dir("${REPO}")
} // steps
} // stage('Build Documentation')
} // stages
post {
cleanup {
xcoreCleanSandbox()
}
} // post
} // stage('legacy xmake build + build documentation')
} // parallel
} // stage('Build')
stage('Regression Test') {
parallel {
stage('MacOS Intel') {
agent {
label 'usb_audio && macos && x86_64 && xcore200-mcab && xcore.ai-explorer'
}
steps {
println "Stage running on ${env.NODE_NAME}"
dir("sw_audio_analyzer") {
copyArtifacts filter: '**/*.xe', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
copyArtifacts filter: 'host_xscope_controller/bin_macos/xscope_controller', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
}
dir("${REPO}") {
checkout_shallow()
clone_test_deps()
unstash 'xk_216_mc_bin'
unstash 'xk_evk_xu316_bin'
dir("tests") {
createVenv(reqFile: "requirements.txt")
dir("tools") {
// Build test support application
dir("${WORKSPACE}/hardware_test_tools") {
sh 'cmake -B build -G Ninja'
sh 'ninja -C build'
dir("xsig") {
copyArtifacts filter: 'bin-macos-x86/xsig', fingerprintArtifacts: true, projectName: 'xmos-int/xsig/master', flatten: true, selector: lastSuccessful()
}
dir("xmosdfu") {
copyArtifacts filter: 'OSX/x86/xmosdfu', fingerprintArtifacts: true, projectName: 'XMOS/lib_xua/develop', flatten: true, selector: lastSuccessful()
}
}
copyArtifacts filter: 'OSX/x86/xmos_mixer', fingerprintArtifacts: true, projectName: 'XMOS/lib_xua/develop', flatten: true, selector: lastSuccessful()
}
withTools("${env.TOOLS_VERSION}") {
withEnv(["USBA_MAC_PRIV_WORKAROUND=1"]) {
withVenv() {
sh "pip install -e ${WORKSPACE}/xtagctl"
withXTAG(["usb_audio_mc_xs2_dut", "usb_audio_mc_xs2_harness", \
"usb_audio_xcai_exp_dut", "usb_audio_xcai_exp_harness"]) { xtagIds ->
sh "pytest -v --level ${params.TEST_LEVEL} --junitxml=pytest_result_mac_intel.xml \
-o xk_216_mc_dut=${xtagIds[0]} -o xk_216_mc_harness=${xtagIds[1]} \
-o xk_evk_xu316_dut=${xtagIds[2]} -o xk_evk_xu316_harness=${xtagIds[3]}"
}
}
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: "${REPO}/tests/pytest_result_mac_intel.xml", fingerprint: true, allowEmptyArchive: true
archiveArtifacts artifacts: "${WORKSPACE}/hardware_test_tools/xsig/glitch.*.csv", fingerprint: true, allowEmptyArchive: true
junit "${REPO}/tests/pytest_result_mac_intel.xml"
}
cleanup {
xcoreCleanSandbox()
}
}
} // MacOS Intel
stage('MacOS ARM') {
agent {
label 'usb_audio && macos && arm64 && xcore.ai-mcab'
}
steps {
println "Stage running on ${env.NODE_NAME}"
dir("sw_audio_analyzer") {
copyArtifacts filter: '**/*.xe', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
copyArtifacts filter: 'host_xscope_controller/bin_macos/xscope_controller', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
}
dir("${REPO}") {
checkout_shallow()
clone_test_deps()
unstash 'xk_316_mc_bin'
dir("tests") {
createVenv(reqFile: "requirements.txt")
dir("tools") {
// Build test support application
dir("${WORKSPACE}/hardware_test_tools") {
sh 'cmake -B build -G Ninja'
sh 'ninja -C build'
dir("xsig") {
copyArtifacts filter: 'bin-macos-arm/xsig', fingerprintArtifacts: true, projectName: 'xmos-int/xsig/master', flatten: true, selector: lastSuccessful()
}
dir("xmosdfu") {
copyArtifacts filter: 'OSX/arm64/xmosdfu', fingerprintArtifacts: true, projectName: 'XMOS/lib_xua/develop', flatten: true, selector: lastSuccessful()
}
}
copyArtifacts filter: 'OSX/x86/xmos_mixer', fingerprintArtifacts: true, projectName: 'XMOS/lib_xua/develop', flatten: true, selector: lastSuccessful()
}
withTools("${env.TOOLS_VERSION}") {
withEnv(["USBA_MAC_PRIV_WORKAROUND=1"]) {
withVenv() {
sh "pip install -e ${WORKSPACE}/xtagctl"
withXTAG(["usb_audio_mc_xcai_dut", "usb_audio_mc_xcai_harness"]) { xtagIds ->
sh "pytest -v --level ${params.TEST_LEVEL} --junitxml=pytest_result_mac_arm.xml \
-o xk_316_mc_dut=${xtagIds[0]} -o xk_316_mc_harness=${xtagIds[1]}"
}
}
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: "${REPO}/tests/pytest_result_mac_arm.xml", fingerprint: true, allowEmptyArchive: true
archiveArtifacts artifacts: "${WORKSPACE}/hardware_test_tools/xsig/glitch.*.csv", fingerprint: true, allowEmptyArchive: true
junit "${REPO}/tests/pytest_result_mac_arm.xml"
}
cleanup {
xcoreCleanSandbox()
}
}
} // MacOS ARM
stage('Windows 10') {
when {
expression {
params.TEST_LEVEL == "nightly" ||
params.TEST_LEVEL == "weekend"
}
}
agent {
label 'usb_audio && windows10 && xcore.ai-mcab'
}
steps {
println "Stage running on ${env.NODE_NAME}"
dir("sw_audio_analyzer") {
copyArtifacts filter: '**/*.xe', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
copyArtifacts filter: 'host_xscope_controller/bin_windows/xscope_controller.exe', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
}
dir("${REPO}") {
checkout_shallow()
clone_test_deps()
unstash 'xk_316_mc_bin'
dir("tests") {
createVenv(reqFile: "requirements.txt")
dir("tools") {
dir("${WORKSPACE}/hardware_test_tools") {
withVS() {
sh "cmake -B build -G Ninja"
sh "ninja -C build"
}
dir("xsig") {
copyArtifacts filter: 'bin-windows-x86/xsig.exe', fingerprintArtifacts: true, projectName: 'xmos-int/xsig/master', flatten: true, selector: lastSuccessful()
}
}
copyArtifacts filter: 'Win/x64/xmos_mixer.exe', fingerprintArtifacts: true, projectName: 'XMOS/lib_xua/develop', flatten: true, selector: lastSuccessful()
}
withTools("${env.TOOLS_VERSION}") {
withVenv() {
dir("${WORKSPACE}/xtagctl") {
sh "pip install -e ."
}
withXTAG(["usb_audio_mc_xcai_dut", "usb_audio_mc_xcai_harness"]) { xtagIds ->
sh "pytest -v --level ${params.TEST_LEVEL} --junitxml=pytest_result_windows10.xml \
-o xk_316_mc_dut=${xtagIds[0]} -o xk_316_mc_harness=${xtagIds[1]}"
}
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: "${REPO}/tests/pytest_result_windows10.xml", fingerprint: true, allowEmptyArchive: true
archiveArtifacts artifacts: "${WORKSPACE}/hardware_test_tools/xsig/glitch.*.csv", fingerprint: true, allowEmptyArchive: true
junit "${REPO}/tests/pytest_result_windows10.xml"
}
cleanup {
xcoreCleanSandbox()
}
}
} // Windows 10
stage('Windows 11') {
when {
expression {
params.TEST_LEVEL == "nightly" ||
params.TEST_LEVEL == "weekend"
}
}
agent {
label 'usb_audio && windows11 && xcore.ai-mcab'
}
steps {
println "Stage running on ${env.NODE_NAME}"
dir("sw_audio_analyzer") {
copyArtifacts filter: '**/*.xe', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
copyArtifacts filter: 'host_xscope_controller/bin_windows/xscope_controller.exe', fingerprintArtifacts: true, projectName: 'xmos-int/sw_audio_analyzer/master', selector: lastSuccessful()
}
dir("${REPO}") {
checkout_shallow()
clone_test_deps()
unstash 'xk_316_mc_bin'
dir("tests") {
createVenv(reqFile: "requirements.txt")
dir("tools") {
dir("${WORKSPACE}/hardware_test_tools") {
withVS() {
sh "cmake -B build -G Ninja"
sh "ninja -C build"
}
dir("xsig") {
copyArtifacts filter: 'bin-windows-x86/xsig.exe', fingerprintArtifacts: true, projectName: 'xmos-int/xsig/master', flatten: true, selector: lastSuccessful()
}
}
copyArtifacts filter: 'Win/x64/xmos_mixer.exe', fingerprintArtifacts: true, projectName: 'XMOS/lib_xua/develop', flatten: true, selector: lastSuccessful()
}
withTools("${env.TOOLS_VERSION}") {
withVenv() {
dir("${WORKSPACE}/xtagctl") {
sh "pip install -e ."
}
withXTAG(["usb_audio_mc_xcai_dut", "usb_audio_mc_xcai_harness"]) { xtagIds ->
sh "pytest -v --level ${params.TEST_LEVEL} --junitxml=pytest_result_windows11.xml \
-o xk_316_mc_dut=${xtagIds[0]} -o xk_316_mc_harness=${xtagIds[1]}"
}
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: "${REPO}/tests/pytest_result_windows11.xml", fingerprint: true, allowEmptyArchive: true
archiveArtifacts artifacts: "${WORKSPACE}/hardware_test_tools/xsig/glitch.*.csv", fingerprint: true, allowEmptyArchive: true
junit "${REPO}/tests/pytest_result_windows11.xml"
}
cleanup {
xcoreCleanSandbox()
}
}
} // Windows 11
}
} // Regression Test
}
}