Skip to content

Add jenkinsfile #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/groovy

boolean continuePipeline = false
def nodeLabel = 'ci-python-35'

jenkinsTemplate(nodeLabel, ['docker', 'python35']) {
node(nodeLabel) {
checkout scm

stage('Install jenkins dependencies') {
container('python') {
sh 'pip install setuptools pylint pep8 coverage pytest'
}
}

stage('Running tests') {
container('python') {
parallel(
'Unit tests': {
sh 'python setup.py test'
sh 'coverage xml -o coverage.xml'
},
'PEP8': {
sh 'pep8 --max-line-length=99 rest_framework_digestauth > pep8.report || true'
},
'Pylint': {
sh 'pylint rest_framework_digestauth > pylint.report || true'
}
)
}
}
helpers.publishResults()
}


if (env.BRANCH_NAME == 'master') {
continuePipeline = true
}

if(continuePipeline) {
stage('Approval') {
timeout(time:1, unit:'HOURS') {
input message:'Approve upload on pypi?'
continuePipeline = true
}
}

node(nodeLabel) {
checkout scm

stage ('Building package') {
container('python') {
sh 'python setup.py sdist'
}
}

stage ('Publish on PyPi') {
withCredentials([file(credentialsId: 'pypirc', variable: 'pypirc')]) {
container('python') {
sh 'pip install twine'
sh "twine upload --config-file $pypirc --repository internal dist/*"
}
}
}
}
}
}