-
Notifications
You must be signed in to change notification settings - Fork 20
/
Jenkinsfile
202 lines (196 loc) · 8.86 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
@Library('[email protected]') _
def runningOn(machine) {
println "Stage running on:"
println machine
}
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
options {
disableConcurrentBuilds()
skipDefaultCheckout()
timestamps()
// on develop discard builds after a certain number else keep forever
buildDiscarder(logRotator(
numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '',
artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : ''
))
}
parameters {
string(
name: 'TOOLS_VERSION',
// Dropped back from 15.3.0 on 2nd August 2024 because of http://bugzilla.xmos.local/show_bug.cgi?id=18895
defaultValue: '15.2.1',
description: 'The XTC tools version'
)
}
environment {
PYTHON_VERSION = "3.8.11"
VENV_DIRNAME = ".venv"
BUILD_DIRNAME = "dist"
RTOS_TEST_RIG_TARGET = "XCORE-AI-EXPLORER"
LOCAL_WIFI_SSID = credentials('bristol-office-development-wifi-ssid')
LOCAL_WIFI_PASS = credentials('bristol-office-development-wifi-password')
}
stages {
stage('Build and Docs') {
parallel {
stage('Build Docs') {
agent { label "documentation" }
steps {
runningOn(env.NODE_NAME)
dir('fwk_rtos'){
checkout scm
createVenv()
withTools(params.TOOLS_VERSION) {
buildDocs("fwk_rtos_docs.zip")
} // withTools
} // dir
} // steps
post {
cleanup {
xcoreCleanSandbox()
}
}
} // Build Docs
stage('Build and Test') {
when {
expression { !env.GH_LABEL_DOC_ONLY.toBoolean() }
}
agent {
label 'xcore.ai-explorer-hil-tests'
}
stages {
stage('Checkout') {
steps {
runningOn(env.NODE_NAME)
checkout scm
sh 'git submodule update --init --recursive --depth 1 --jobs \$(nproc)'
}
}
stage('Build tests and host apps') {
steps {
script {
uid = sh(returnStdout: true, script: 'id -u').trim()
gid = sh(returnStdout: true, script: 'id -g').trim()
}
// pull docker
sh "docker pull ghcr.io/xmos/xcore_voice_tester:develop"
withTools(params.TOOLS_VERSION) {
sh "bash tools/ci/build_rtos_tests.sh"
sh "bash tools/ci/build_host_apps.sh"
}
// List built files for log
sh "ls -la dist/"
sh "ls -la dist_host/"
}
}
stage('Create virtual environment') {
steps {
// Create venv
sh "pyenv install -s $PYTHON_VERSION"
sh "~/.pyenv/versions/$PYTHON_VERSION/bin/python -m venv $VENV_DIRNAME"
// 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') {
steps {
// Cleanup any xtagctl cruft from previous failed runs
withTools(params.TOOLS_VERSION) {
withVenv {
sh "xtagctl reset_all $RTOS_TEST_RIG_TARGET"
}
}
sh "rm -f ~/.xtag/status.lock ~/.xtag/acquired"
}
}
// TODO Disabled till https://xmosjira.atlassian.net/browse/AP-353 is fixed
//stage('Run RTOS Drivers WiFi test') {
// steps {
// withTools(params.TOOLS_VERSION) {
// withVenv {
// script {
// withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs ->
// sh "test/rtos_drivers/wifi/check_wifi.sh " + adapterIDs[0]
// }
// sh "pytest test/rtos_drivers/wifi"
// }
// }
// }
// }
//}
stage('Run RTOS Drivers HIL test') {
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/rtos_drivers/hil/check_drivers_hil.sh " + adapterIDs[0]
}
sh "pytest test/rtos_drivers/hil"
}
}
}
}
}
stage('Run RTOS Drivers HIL_Add test') {
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs ->
sh "test/rtos_drivers/hil_add/check_drivers_hil_add.sh " + adapterIDs[0]
}
sh "pytest test/rtos_drivers/hil_add"
}
}
}
}
}
stage('Run RTOS Drivers USB test') {
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs ->
sh "bash -l test/rtos_drivers/usb/check_usb.sh " + adapterIDs[0]
}
sh "pytest test/rtos_drivers/usb"
}
}
}
}
}
}
post {
cleanup {
// cleanWs 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()
}
}
}
}
}
}
}