forked from xmos/lib_src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
186 lines (177 loc) · 5.65 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
@Library('[email protected]')
def runningOn(machine) {
println "Stage running on:"
println machine
}
// run pytest with common flags for project. any passed in though extra args will
// be appended
def localRunPytest(String extra_args="") {
catchError{
sh "python -m pytest --junitxml=pytest_result.xml -rA -v --durations=0 -o junit_logging=all ${extra_args}"
}
junit "pytest_result.xml"
}
getApproval()
pipeline {
agent none
environment {
REPO = 'lib_src'
VIEW = getViewName(REPO)
PYTHON_VERSION = "3.10.5"
VENV_DIRNAME = ".venv"
XMOSDOC_VERSION = "pr-67"
}
options {
skipDefaultCheckout()
timestamps()
}
parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.2.1',
description: 'The XTC tools version'
)
}
stages {
stage('Build and Test') {
when {
expression { !env.GH_LABEL_DOC_ONLY.toBoolean() }
}
agent {
label 'x86_64&&docker' // These agents have 24 cores so good for parallel xsim runs
}
stages {
stage('Get repo') {
steps {
sh "mkdir ${REPO}"
// source checks require the directory
// name to be the same as the repo name
dir("${REPO}") {
// checkout repo
checkout scm
sh 'git submodule update --init --recursive --depth 1'
}
}
}
stage ("Create Python environment") {
steps {
dir("${REPO}") {
createVenv('requirements.txt')
withVenv {
sh 'pip install -r requirements.txt'
}
}
}
}
stage('Library checks') {
steps {
dir("${REPO}") {
sh 'git clone [email protected]:xmos/infr_apps.git'
sh 'git clone [email protected]:xmos/infr_scripts_py.git'
// These are needed for xmake legacy build and also changelog check
sh 'git clone [email protected]:xmos/lib_logging.git'
sh 'git clone [email protected]:xmos/lib_xassert.git'
withVenv {
sh 'pip install -e infr_scripts_py'
sh 'pip install -e infr_apps'
dir("tests") {
withEnv(["XMOS_ROOT=.."]) {
localRunPytest('-s test_lib_checks.py -vv')
}
}
}
}
}
}
stage('Test xmake build') {
steps {
runningOn(env.NODE_NAME)
dir("${REPO}") {
withTools(params.TOOLS_VERSION) {
withVenv {
dir("tests") {
localRunPytest('-k "legacy" -vv')
}
}
}
}
}
}
stage('Run doc python') {
steps {
runningOn(env.NODE_NAME)
dir("${REPO}") {
withTools(params.TOOLS_VERSION) {
withVenv {
dir("doc/python") {
sh "python -m doc_asrc.py"
}
sh "docker pull ghcr.io/xmos/doc_builder:$XMOSDOC_VERSION"
sh """docker run -u "\$(id -u):\$(id -g)" \
--rm \
-v ${WORKSPACE}/${REPO}:/build \
ghcr.io/xmos/doc_builder:$XMOSDOC_VERSION -v"""
sh "zip -r doc_build.zip doc/_build"
archiveArtifacts artifacts: "doc_build.zip", allowEmptyArchive: true
}
}
}
}
}
stage('Tests XS2') {
steps {
runningOn(env.NODE_NAME)
dir("${REPO}") {
withTools(params.TOOLS_VERSION) {
withVenv {
sh 'mkdir -p build'
dir("build") {
sh 'rm CMakeCache.txt'
sh 'cmake --toolchain ../xmos_cmake_toolchain/xs2a.cmake ..'
sh 'make test_ds3_voice test_us3_voice test_unity_gain_voice -j'
}
dir("tests") {
localRunPytest('-n auto -k "xs2" -vv')
}
dir("build") {
sh 'rm CMakeCache.txt' // Cleanup XS2 cmake cache for next stage
}
}
}
}
}
}
stage('Tests XS3') {
steps {
runningOn(env.NODE_NAME)
dir("${REPO}") {
withTools(params.TOOLS_VERSION) {
withVenv {
dir("tests") {
localRunPytest('-m prepare') // Do all pre work like building and generating golden ref where needed
// FF3 HiFi tests for OS3 and DS3
localRunPytest('-m main -n auto -k "hifi_ff3" -vv')
// ASRC and SSRC tests across all in/out freqs and deviations (asrc only)
localRunPytest('-m main -n auto -k "mrhf" -vv')
archiveArtifacts artifacts: "mips_report*.csv", allowEmptyArchive: true
// VPU enabled ff3 and rat tests
localRunPytest('-m main -k "vpu" -vv') // xdist not working yet so no -n auto
// Profile the ASRC
localRunPytest('-m main -k "profile_asrc" -vv')
sh 'tree'
archiveArtifacts artifacts: "gprof_results/*.png", allowEmptyArchive: true
}
}
}
}
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
}
}