-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
63 lines (57 loc) · 1.83 KB
/
Copy pathJenkinsfile
File metadata and controls
63 lines (57 loc) · 1.83 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
62
63
pipeline {
agent any
options {
buildDiscarder(logRotator(daysToKeepStr: '10', numToKeepStr: '10'))
timeout(time: 12, unit: 'HOURS')
timestamps()
}
stages {
stage('Requirements') {
steps {
dir("${env.WORKSPACE}/Ch05/05_02-publish-reports"){
sh 'python3 -m venv venv'
sh './venv/bin/pip3 install --upgrade --requirement requirements.txt'
}
}
}
stage('Lint') {
steps {
dir("${env.WORKSPACE}/Ch05/05_02-publish-reports"){
sh 'venv/bin/flake8 --ignore=E501,E231 *.py'
sh 'venv/bin/pylint --errors-only --disable=C0301 --disable=C0326 *.py'
}
}
}
stage('Test') {
steps {
dir("${env.WORKSPACE}/Ch05/05_02-publish-reports"){
sh('''
venv/bin/coverage run -m pytest -v test_*.py \
--junitxml=pytest_junit.xml
''')
}
}
}
stage('Build') {
steps {
echo "Build the application in this step..."
}
}
stage('Deploy') {
steps {
echo "Deploy the application in this step..."
}
}
}
post {
always {
dir("${env.WORKSPACE}/Ch05/05_02-publish-reports"){
sh 'venv/bin/coverage xml'
}
junit allowEmptyResults: true, testResults: '**/pytest_junit.xml'
junit allowEmptyResults: true, testResults: '**/pylint_junit.xml'
publishCoverage adapters: [cobertura('**/coverage.xml')],
sourceFileResolver: sourceFiles('STORE_LAST_BUILD')
}
}
}