changes in file14

This commit is contained in:
shikhar.s 2019-07-05 21:30:57 +05:30
parent 5045f95fc2
commit f4f46da249
2 changed files with 53 additions and 93 deletions

135
Jenkinsfile vendored
View File

@ -1,8 +1,3 @@
#!/usr/bin/env groovy
/**
* Jenkinsfile
*/
pipeline { pipeline {
agent any agent any
options { options {
@ -43,98 +38,57 @@ pipeline {
} }
} }
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') { // stage ('Check_style') {
// steps {
// sh """
// if [ ! -d venv ] ; then
// 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: [
// [
// parserName: 'pylint',
// pattern: 'report/pylint.log'
// ]],
// unstableTotalAll: '0',
// usePreviousBuildAsReference: true
// ])
// }
// }
stage('Test environment') {
steps { steps {
sh """ sh '''
echo ${SHELL}
[ -d venv ] && rm -rf venv
#virtualenv --python=python2.7 venv
virtualenv venv
#. venv/bin/activate #. venv/bin/activate
export PATH=${VIRTUAL_ENV}/bin:${PATH} export PATH=${VIRTUAL_ENV}/bin:${PATH}
make unittest || true python setup.py install
""" sudo /home/cis/.local/bin/nosetests --with-xunit tests
} '''
post {
always {
junit keepLongStdio: true, testResults: 'report/nosetests.xml'
publishHTML target: [
reportDir: 'report/coverage',
reportFiles: 'index.html',
reportName: 'Coverage Report - Unit Test'
]
}
} }
} }
stage ('System Tests') {
stage('Test Run') {
steps { steps {
sh """ sh '''python src/bitmessagemain.py -t'''
#. venv/bin/activate
export PATH=${VIRTUAL_ENV}/bin:${PATH}
// Write file containing test node connection information if needed.
// 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 ('Docs') {
steps {
sh """
#. 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'
]
}
} }
} }
@ -145,6 +99,7 @@ pipeline {
} }
} }
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 " +
@ -163,4 +118,6 @@ pipeline {
to: env.emailTo to: env.emailTo
} }
} }
} }

View File

@ -7,6 +7,7 @@ pipeline {
stages { stages {
stage('Build environment') { stage('Build environment') {
steps { steps {
sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate''' sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate'''
@ -18,6 +19,7 @@ pipeline {
sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate
cd /home/cis/Desktop/Python/PyBitmessage cd /home/cis/Desktop/Python/PyBitmessage
sudo python setup.py install sudo python setup.py install
sudo su
sudo /home/cis/.local/bin/nosetests --with-xunit tests sudo /home/cis/.local/bin/nosetests --with-xunit tests
''' '''
} }
@ -29,6 +31,7 @@ pipeline {
} }
} }
} }
post { post {
failure { failure {
echo "Send e-mail, when failed" echo "Send e-mail, when failed"