-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
110 lines (94 loc) · 3.75 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
pipeline {
agent {
label 'camtango_nodb_bionic'
}
environment {
KATPACKAGE = "${(env.JOB_NAME - env.JOB_BASE_NAME) - '-multibranch/'}"
}
stages {
stage ('Checkout SCM') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: "refs/heads/${env.BRANCH_NAME}"]],
extensions: [[$class: 'LocalBranch']],
userRemoteConfigs: scm.userRemoteConfigs,
doGenerateSubmoduleConfigurations: false,
submoduleCfg: []
])
}
}
stage ('Static analysis') {
steps {
sh "pylint ./${KATPACKAGE} --output-format=parseable --exit-zero > pylint.out"
sh "lint_diff.sh -r ${KATPACKAGE}"
}
}
stage ('Install & Unit Tests') {
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
environment {
test_flags = "${KATPACKAGE}"
}
steps {
echo "Running nosetests on Python 2.7"
sh 'python2 -m pip install -U .'
sh 'python2 -m coverage run --source="${KATPACKAGE}" -m nose --with-xunitmp --xunitmp-file=nosetests_py27.xml'
sh 'python2 -m coverage xml -o coverage_27.xml'
sh 'python2 -m coverage report -m --skip-covered'
echo "Running nosetests on Python 3.6"
sh 'python3 -m pip install -U .'
sh 'python3 -m coverage run --source="${KATPACKAGE}" -m nose --with-xunitmp --xunitmp-file=nosetests_py36.xml'
sh 'python3 -m coverage xml -o coverage_36.xml'
sh 'python3 -m coverage report -m --skip-covered'
}
post {
always {
junit 'nosetests_*.xml'
cobertura (
coberturaReportFile: 'coverage_*.xml',
failNoReports: true,
failUnhealthy: true,
failUnstable: true,
autoUpdateHealth: true,
autoUpdateStability: true,
zoomCoverageChart: true,
// TODO: The reason this is commented out is because tango-simlib test coverage is currently at 70% instead of minimum 80%.
// lineCoverageTargets: '80, 80, 80',
// conditionalCoverageTargets: '80, 80, 80',
// classCoverageTargets: '80, 80, 80',
// fileCoverageTargets: '80, 80, 80',
)
archiveArtifacts '*.xml'
}
}
}
stage ('Generate documentation.') {
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
steps {
echo "Generating Sphinx documentation."
sh 'make -C doc html'
}
}
stage ('Build & publish packages') {
when {
branch 'master'
}
steps {
sh 'fpm -s python -t deb .'
sh 'python setup.py bdist_wheel'
sh 'mv *.deb dist/'
archiveArtifacts 'dist/*'
// Trigger downstream publish job
build job: 'ci.publish-artifacts', parameters: [
string(name: 'job_name', value: "${env.JOB_NAME}"),
string(name: 'build_number', value: "${env.BUILD_NUMBER}")]
}
}
}
}