changes in jenkins file

This commit is contained in:
shikhar.s 2019-07-05 19:14:24 +05:30
parent b372c64a51
commit 3156423597

147
Jenkinsfile vendored
View File

@ -1,31 +1,13 @@
#!/usr/bin/env groovy
/**
* Jenkinsfile
*/
pipeline { pipeline {
agent any agent any
options {
buildDiscarder( triggers {
// Only keep the 10 most recent builds pollSCM('*/5 * * * *')
logRotator(numToKeepStr:'10'))
}
environment {
projectName = 'BitMessage'
emailTo = 'kuldeep.m@cisinlabs.com'
emailFrom = 'kuldeep.m@cisinlabs.com'
VIRTUAL_ENV = "${env.WORKSPACE}/venv"
} }
stages { stages {
/*
stage ('Checkout') {
steps {
checkout scm
}
}
*/
stage ('Install_Requirements') { stage ('Install_Requirements') {
steps { steps {
@ -43,108 +25,51 @@ pipeline {
} }
} }
// stage ('Check_style') { stage ('Check_style') {
// steps {
// sh """
// #. venv/bin/activate
// [ -d report ] || mkdir report
// export PATH=${VIRTUAL_ENV}/bin:${PATH}
// make check || true
// """
// sh """
// export PATH=${VIRTUAL_ENV}/bin:${PATH}
// make flake8 | tee report/flake8.log || true
// """
// sh """
// export PATH=${VIRTUAL_ENV}/bin:${PATH}
// make pylint | tee report/pylint.log || true
// """
// step([$class: 'WarningsPublisher',
// parserConfigurations: [[
// parserName: 'Pep8',
// pattern: 'report/flake8.log'
// ],
// [
// parserName: 'pylint',
// pattern: 'report/pylint.log'
// ]],
// unstableTotalAll: '0',
// usePreviousBuildAsReference: true
// ])
// }
// }
stage ('Unit Tests') {
steps { steps {
sh """ sh """
#. venv/bin/activate if [ ! -d venv ] ; then
export PATH=${VIRTUAL_ENV}/bin:${PATH}
make unittest || true virtualenv --python=python2.7 venv
fi
source venv/bin/activate
export PYTHONPATH="$PWD:$PYTHONPATH"
pip install pylint
cd repo
### Need this because some strange control sequences when using default TERM=xterm
export TERM="linux"
## || exit 0 because pylint only exits with 0 if everything is correct
pylint --rcfile=pylint.cfg $(find . -maxdepth 1 -name "*.py" -print) MYMODULE/ > pylint.log || exit 0
""" """
} step([$class: 'WarningsPublisher',
parserConfigurations: [
post { [
always { parserName: 'pylint',
junit keepLongStdio: true, testResults: 'report/nosetests.xml' pattern: 'report/pylint.log'
publishHTML target: [ ]],
reportDir: 'report/coverage', unstableTotalAll: '0',
reportFiles: 'index.html', usePreviousBuildAsReference: true
reportName: 'Coverage Report - Unit Test' ])
]
}
} }
} }
stage ('System Tests') { stage('Test environment') {
steps { steps {
sh """ sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate
#. venv/bin/activate sh '''cd /home/cis/Desktop/Python/PyBitmessage'''
export PATH=${VIRTUAL_ENV}/bin:${PATH} sh '''sudo python setup.py install'''
// Write file containing test node connection information if needed. sh '''sudo /home/cis/.local/bin/nosetests --with-xunit tests'''
// writeFile file: "test/fixtures/nodes.yaml", text: "---\n- node: <some-ip>\n"
make systest || true
"""
}
post {
always {
junit keepLongStdio: true, testResults: 'report/nosetests.xml'
publishHTML target: [
reportDir: 'report/coverage',
reportFiles: 'index.html',
reportName: 'Coverage Report - System Test'
]
} }
} }
} stage('Test Run') {
stage ('Docs') {
steps { steps {
sh """ sh '''python /home/cis/Desktop/Python/PyBitmessage/src/bitmessagemain.py -t'''
#. venv/bin/activate
export PATH=${VIRTUAL_ENV}/bin:${PATH}
PYTHONPATH=. pdoc --html --html-dir docs --overwrite env.projectName
"""
}
post {
always {
publishHTML target: [
reportDir: 'docs/*',
reportFiles: 'index.html',
reportName: 'Module Documentation'
]
} }
} }
} }
stage ('Cleanup') {
steps {
sh 'rm -rf venv'
}
}
}
post { post {
failure { failure {
mail body: "${env.JOB_NAME} (${env.BUILD_NUMBER}) ${env.projectName} build error " + mail body: "${env.JOB_NAME} (${env.BUILD_NUMBER}) ${env.projectName} build error " +