forked from cloudant/python-cloudant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
43 lines (42 loc) · 1.36 KB
/
Copy pathJenkinsfile
File metadata and controls
43 lines (42 loc) · 1.36 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
// Define the test routine for different python versions
def test_python(pythonVersion)
{
node {
// Unstash the source on this node
unstash name: 'source'
// Set up the environment and test
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'clientlibs-test', usernameVariable: 'DB_USER', passwordVariable: 'DB_PASSWORD']]) {
try {
sh """ virtualenv tmp -p /usr/local/lib/python${pythonVersion}/bin/${pythonVersion.startsWith('3') ? "python3" : "python"}
. ./tmp/bin/activate
echo \$DB_USER
export RUN_CLOUDANT_TESTS=1
export CLOUDANT_ACCOUNT=\$DB_USER
# Temporarily disable the _db_updates tests pending resolution of case 71610
export SKIP_DB_UPDATES=1
pip install -r requirements.txt
pip install -r test-requirements.txt
pylint ./src/cloudant
nosetests -w ./tests/unit --with-xunit"""
} finally {
// Load the test results
junit 'nosetests.xml'
}
}
}
}
// Start of build
stage('Checkout'){
// Checkout and stash the source
node{
checkout scm
stash name: 'source'
}
}
stage('Test'){
// Run tests in parallel for multiple python versions
parallel(
Python2: {test_python('2.7.12')},
Python3: {test_python('3.5.2')}
)
}