changes in jenkins file

This commit is contained in:
shikhar.s 2019-09-24 16:05:01 +05:30
parent 7a66fa2279
commit 9d648566d6
6 changed files with 39 additions and 209 deletions

3
.gitignore vendored
View File

@ -18,3 +18,6 @@ dist
docs/_*/* docs/_*/*
docs/autodoc/ docs/autodoc/
pyan/ pyan/
*.swp
tags
.coverage

34
Jenkinsfile vendored
View File

@ -103,6 +103,23 @@ pipeline {
} }
} }
// stage('Nosetest'){
// steps{
// sh '''
// echo ${SHELL}
// [ -d venv ] && rm -rf venv
// #virtualenv --python=python2.7 venv
// virtualenv venv
// #. venv/bin/activate
// export PATH=${VIRTUAL_ENV}/bin:${PATH}
// python setup.py install
// sudo apt-get install python-mock python-nose python-coverage pylint
// '''
// }
// }
// stage('Pylint Checker') { // stage('Pylint Checker') {
// steps { // steps {
// sh ''' // sh '''
@ -200,6 +217,23 @@ pipeline {
} }
} }
} }
stage('Setup Test') {
steps {
sh ''' export PATH=${VIRTUAL_ENV}/bin:${PATH}
pip install pytest
pip install psutil
pip install python-prctl==1.5.0
python -m pytest --verbose --junit-xml results.xml
'''
}
post {
always {
// Archive unit tests for the future
junit allowEmptyResults: true, testResults: 'results.xml'
}
}
}
// stage('Unit tests') { // stage('Unit tests') {
// steps { // steps {
// sh ''' source activate ${BUILD_TAG} // sh ''' source activate ${BUILD_TAG}

View File

@ -1,40 +0,0 @@
pipeline {
agent any
triggers {
pollSCM('*/5 * * * *')
}
stages {
stage('Build environment') {
steps {
sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate'''
sh '''pip install -r /home/cis/Desktop/Python/PyBitmessage/requirements.txt'''
}
}
stage('Test environment') {
steps {
sh '''source /home/cis/Desktop/ENV/pybitenv/bin/activate
cd /home/cis/Desktop/Python/PyBitmessage
sudo python setup.py install
sudo su
sudo /home/cis/.local/bin/nosetests --with-xunit tests
'''
}
}
stage('Test Run') {
steps {
sh '''python /home/cis/Desktop/Python/PyBitmessage/src/bitmessagemain.py -t
'''
}
}
}
post {
failure {
echo "Send e-mail, when failed"
}
}
}

View File

@ -1,166 +0,0 @@
#!/usr/bin/env groovy
/**
* Jenkinsfile
*/
pipeline {
agent any
options {
buildDiscarder(
// Only keep the 10 most recent builds
logRotator(numToKeepStr:'10'))
}
environment {
projectName = 'BitMessage'
emailTo = 'kuldeep.m@cisinlabs.com'
emailFrom = 'kuldeep.m@cisinlabs.com'
VIRTUAL_ENV = "${env.WORKSPACE}/venv"
}
stages {
/*
stage ('Checkout') {
steps {
checkout scm
}
}
*/
stage ('Install_Requirements') {
steps {
sh """
echo ${SHELL}
[ -d venv ] && rm -rf venv
#virtualenv --python=python2.7 venv
virtualenv venv
#. venv/bin/activate
export PATH=${VIRTUAL_ENV}/bin:${PATH}
pip install --upgrade pip
pip install -r requirements.txt -r dev-requirements.txt
make clean
"""
}
}
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 {
sh """
#. venv/bin/activate
export PATH=${VIRTUAL_ENV}/bin:${PATH}
make unittest || true
"""
}
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') {
steps {
sh """
#. 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'
]
}
}
}
stage ('Cleanup') {
steps {
sh 'rm -rf venv'
}
}
}
post {
failure {
mail body: "${env.JOB_NAME} (${env.BUILD_NUMBER}) ${env.projectName} build error " +
"is here: ${env.BUILD_URL}\nStarted by ${env.BUILD_CAUSE}" ,
from: env.emailFrom,
//replyTo: env.emailFrom,
subject: "${env.projectName} ${env.JOB_NAME} (${env.BUILD_NUMBER}) build failed",
to: env.emailTo
}
success {
mail body: "${env.JOB_NAME} (${env.BUILD_NUMBER}) ${env.projectName} build successful\n" +
"Started by ${env.BUILD_CAUSE}",
from: env.emailFrom,
//replyTo: env.emailFrom,
subject: "${env.projectName} ${env.JOB_NAME} (${env.BUILD_NUMBER}) build successful",
to: env.emailTo
}
}
}

View File

@ -1 +0,0 @@
index.html