forked from EasyPost/easypost-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
61 lines (58 loc) · 1.95 KB
/
Jenkinsfile
File metadata and controls
61 lines (58 loc) · 1.95 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
pipeline {
agent {
label 'centos8_01'
}
stages {
stage('Sanitiser') {
steps {
deleteDir()
}
}
stage('Validate Build Env') {
steps {
sh 'sudo salt-call state.highstate'
}
}
stage('Checkout Source') {
steps {
checkout([$class: 'GitSCM', branches: [[name: 'master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/christophermarklee/easypost-python.git']]])
}
}
stage('Setup Env') {
steps {
sh '''
python3.6 -m virtualenv ./venv
./venv/bin/pip install requests six pylint
./venv/bin/pip install -r requirements-tests.txt
'''
}
}
stage('Tests') {
steps {
sh '''
./venv/bin/pylint --exit-zero --output=easypost_pylint.log easypost tests examples
'''
recordIssues(tools: [pyLint(pattern: '**/*pylint.log')])
// Using Test API Key set in Jenkins Credentials manager.
withCredentials([string(credentialsId: 'EasyPost-Test-API-Key', variable: 'TEST_API_KEY')]) {
sh '''
export PROD_API_KEY=''
export TEST_API_KEY=${TEST_API_KEY}
./venv/bin/py.test --junitxml=test_results.xml -v tests || exit 0
'''
recordIssues(tools: [junitParser(pattern: '**/test_results.xml')])
}
}
}
stage('Archive') {
steps {
archiveArtifacts artifacts: '**/test_results.xml, **/*pylint.log', fingerprint: true, followSymlinks: false, onlyIfSuccessful: true
}
}
}
post {
success {
cleanWs()
}
}
}