forked from xmos/lib_qspi_fast_read
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
133 lines (131 loc) · 5.62 KB
/
Copy pathJenkinsfile
File metadata and controls
133 lines (131 loc) · 5.62 KB
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
@Library('xmos_jenkins_shared_library@v0.27.0') _
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',
defaultValue: '15.2.1',
description: 'The XTC tools version'
)
booleanParam(
name: 'NIGHTLY_TEST_ONLY',
defaultValue: false,
description: 'Tests that only run during nightly builds.'
)
}
environment {
PYTHON_VERSION = "3.8.11"
VENV_DIRNAME = ".venv"
BUILD_DIRNAME = "dist"
VRD_TEST_RIG_TARGET = "XCORE-AI-EXPLORER"
}
stages {
stage('Build and Docs') {
parallel {
stage('Build Docs') {
agent { label "docker" }
environment { XMOSDOC_VERSION = "v4.0" }
steps {
checkout scm
sh 'git submodule update --init --recursive --depth 1'
sh "docker pull ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION"
sh """docker run -u "\$(id -u):\$(id -g)" \
--rm \
-v ${WORKSPACE}:/build \
ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION -v"""
archiveArtifacts artifacts: "doc/_build/**", allowEmptyArchive: true
}
post {
cleanup {
xcoreCleanSandbox()
}
}
}
stage('QSPI fast read tests') {
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('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"
}
}
}
stage('Cleanup xtagctl') {
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('Build tests') {
steps {
withTools(params.TOOLS_VERSION) {
script {
sh "tools/ci/build_tests.sh"
}
}
}
}
stage('Run tests') {
steps {
withTools(params.TOOLS_VERSION) {
withVenv {
script {
withXTAG(["$VRD_TEST_RIG_TARGET"]) { adapterIDs ->
try {
sh "tools/ci/config_hardware_str_50.sh " + adapterIDs[0]
sh "tools/ci/run_tests.sh " + adapterIDs[0]
} finally {
sh "tools/ci/restore_factory_settings.sh " + adapterIDs[0]
}
}
}
}
}
}
}
}
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()
}
}
}
}
}
}
}