forked from ska-sa/katcp-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
135 lines (120 loc) · 4.1 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
pipeline {
agent {
label 'cambase_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}-python"
}
post {
always {
recordIssues(tool: pyLint(pattern: 'pylint.out'))
}
}
}
stage ('Install & Unit Tests') {
options {
timestamps()
timeout(time: 30, unit: 'MINUTES')
}
environment {
test_flags = "${KATPACKAGE}"
}
parallel {
stage ('py27') {
steps {
echo "Running nosetests on Python 2.7"
sh 'tox -e py27'
}
}
stage ('py36') {
steps {
echo "Running nosetests on Python 3.6"
sh 'tox -e py36'
}
}
stage ('py37') {
steps {
echo "Running nosetests on Python 3.7"
sh 'tox -e py37'
}
}
stage ('py38') {
steps {
echo "Running nosetests on Python 3.8"
sh 'tox -e py38'
}
}
stage ('py39') {
steps {
echo "Running nosetests on Python 3.9"
sh 'tox -e py39'
}
}
}
post {
always {
junit 'nosetests_*.xml'
cobertura (
coberturaReportFile: 'coverage_*.xml'
//TODO: Investigate and fix these parameters
//failNoReports: true,
//failUnhealthy: true,
//failUnstable: true,
//autoUpdateHealth: true,
//autoUpdateStability: true,
//zoomCoverageChart: true,
//Ideally test coverage should be > 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 'tox -e docs'
}
}
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}")]
}
}
}
}