forked from Crunch-io/requests-safe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
139 lines (133 loc) · 4.51 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
// Work-around for Jenkins not killing/removing older queued jobs
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
// What follows is the actual pipeline that we want Jenkins to go and build, along with all of the stages
pipeline {
options {
timeout(time: 1, unit: 'HOURS')
timestamps()
}
agent none;
stages {
stage("Unit Testing") {
parallel {
stage("Python 3.7") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=3.7'
label 'docker'
}
}
steps {
sh 'tox -e py37'
stash name: 'py37_coverage', includes: '.coverage.py37'
}
post {
always {
junit 'junit.xml'
}
}
}
stage("Python 3.6") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=3.6'
label 'docker'
}
}
steps {
sh 'tox -e py36'
stash name: 'py36_coverage', includes: '.coverage.py36'
}
post {
always {
junit 'junit.xml'
}
}
}
stage("Python 3.5") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=3.5'
label 'docker'
}
}
steps {
sh 'tox -e py35'
stash name: 'py35_coverage', includes: '.coverage.py35'
}
post {
always {
junit 'junit.xml'
}
}
}
stage("Python 2.7") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=2.7'
label 'docker'
}
}
steps {
sh 'tox -e py27'
stash name: 'py27_coverage', includes: '.coverage.py27'
}
post {
always {
junit 'junit.xml'
}
}
}
stage("Linting") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=3.7'
label 'docker'
}
}
steps {
sh 'tox -e lint'
}
}
}
}
stage("Coverage Reporting") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=3.7'
label 'docker'
}
}
steps {
unstash 'py37_coverage'
unstash 'py36_coverage'
unstash 'py35_coverage'
unstash 'py27_coverage'
sh 'tox -e coverage'
cobertura coberturaReportFile: 'coverage.xml'
}
}
stage("Build sdist/wheel") {
agent {
dockerfile {
filename 'Dockerfile.jenkins'
additionalBuildArgs '--build-arg TAG=3.7'
label 'docker'
}
}
steps {
sh 'tox -e build'
archiveArtifacts artifacts: 'dist/*.whl'
archiveArtifacts artifacts: 'dist/*.tar.gz'
}
}
}
}