forked from xmos/lib_nn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
91 lines (86 loc) · 3.52 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
@Library('[email protected]') _
getApproval()
pipeline {
agent {
dockerfile {
args "-v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v /home/jenkins/.ssh:/home/jenkins/.ssh:ro"
}
}
parameters { // Available to modify on the job page within Jenkins if starting a build
string( // use to try different tools versions
name: 'TOOLS_VERSION',
defaultValue: '15.0.6',
description: 'The tools version to build with (check /projects/tools/ReleasesTools/)'
)
}
options { // plenty of things could go here
//buildDiscarder(logRotator(numToKeepStr: '10'))
timestamps()
}
stages {
stage("Setup") {
// Clone and install build dependencies
steps {
// clean auto default checkout
sh "rm -rf *"
// clone
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
threads: 8,
timeout: 20,
shallow: true,
parentCredentials: true,
recursiveSubmodules: true],
[$class: 'CleanCheckout']],
userRemoteConfigs: [[credentialsId: 'xmos-bot',
url: '[email protected]:xmos/lib_nn']]
])
// fetch dependencies
sshagent (credentials: ['xmos-bot']) {
dir("${env.WORKSPACE}/test") {
sh "python fetch_dependencies.py"
}
}
// create venv
sh "conda env create -q -p lib_nn_venv -f environment.yml"
// install xmos tools version
sh "/XMOS/get_tools.py " + params.TOOLS_VERSION
}
}
stage("Update all packages") {
// Roll all conda packages forward beyond their pinned versions
when { expression { return params.UPDATE_ALL } }
steps {
sh "conda update --all -y -q -p lib_nn_venv"
}
}
stage("Build") {
steps {
// below is how we can activate the tools, NOTE: xTIMEcomposer -> XTC at tools 15.0.5
sh """. /XMOS/tools/${params.TOOLS_VERSION}/XMOS/XTC/${params.TOOLS_VERSION}/SetEnv &&
. activate ./lib_nn_venv && mkdir -p build_x86 && cd build_x86 &&
cmake .. && make"""
sh """. /XMOS/tools/${params.TOOLS_VERSION}/XMOS/XTC/${params.TOOLS_VERSION}/SetEnv &&
. activate ./lib_nn_venv && mkdir -p build_xcore && cd build_xcore &&
cmake -DCMAKE_TOOLCHAIN_FILE=../etc/xmos_toolchain.cmake .. && make"""
sh """. /XMOS/tools/${params.TOOLS_VERSION}/XMOS/XTC/${params.TOOLS_VERSION}/SetEnv &&
. activate ./lib_nn_venv &&
cd test/gtests && ./build.sh && make all PLATFORM=x86"""
}
}
stage("Test") {
steps {
sh "./build_x86/test/unit_test/unit_test"
sh "cd test/gtests && ./bin/x86/unit_test"
}
}
}
post {
cleanup {
cleanWs()
}
}
}