Commit 09216807 authored by Patrik Dufresne's avatar Patrik Dufresne

Add gitlab-ci.yml config

parent bef83279
image: ikus060/docker-debian-py2-py3:stretch
stages:
- test
- publish
# Upgrade python and install dependencies to avoid compiling from sources.
before_script:
- apt-get update && apt-get -qq install python-pysqlite2 libldap2-dev libsasl2-dev rdiff-backup node-less
- pip install pip setuptools --upgrade
# TODO Split this by python version and OS.
test_py27:
stage: test
script:
- pip install tox nose coverage --upgrade
- python setup.py build
- export TOXENV=`tox --listenvs | grep "^py27" | tr '\n' ','`
- tox --sitepackages
test_py3:
stage: test
script:
- pip install tox nose coverage --upgrade
- python setup.py build
- export TOXENV=`tox --listenvs | grep "^py3" | tr '\n' ','`
- tox --sitepackages
# TODO Publish coverage repport
# TODO Publish testcases repport
publish_nexus:
stage: publish
script:
- pip install wheel twine --upgrade
- python setup.py sdist bdist_wheel
- twine upload dist/* -u $NEXUS_USR -p $NEXUS_PWD --repository-url $NEXUS_PYPI_URL
publish_pypi:
stage: publish
only:
- master
script:
- pip install wheel twine --upgrade
- python setup.py sdist bdist_wheel
- twine upload dist/* -u $PYPI_USR -p $PYPI_PWD
github_push:
stage: publish
script:
- git push --force https://${GITHUB_USR}:${GITHUB_PWD}@github.com/ikus060/rdiffweb.git refs/remotes/origin/${CI_COMMIT_REF_NAME}:refs/heads/${CI_COMMIT_REF_NAME}
- git push https://${GITHUB_USR}:${GITHUB_PWD}@github.com/ikus060/rdiffweb.git --tags
def axisImages = ['jessie', 'stretch']
def axisPython = ['py27', 'py3']
def axisCherrypy = ['cherrypy35','cherrypy4','cherrypy5','cherrypy6','cherrypy7','cherrypy8','cherrypy9','cherrypy10','cherrypy11','cherrypy12','cherrypy13','cherrypy14']
def builders = [:]
for (x in axisImages) {
for (y in axisPython) {
for (z in axisCherrypy) {
// Need to bind the label variable before the closure - can't do 'for (label in labels)'
def image = x
def python = y
def cherrypy = z
def env = "${python}-${cherrypy}"
// Create a map to pass in to the 'parallel' step so we can fire all the builds at once
builders["${image}-${env}"] = {
node {
/* Requires the Docker Pipeline plugin to be installed */
docker.image("ikus060/docker-debian-py2-py3:${image}").inside {
stage("${image}-${env}:Initialize") {
// Wipe working directory to make sure to build clean.
deleteDir()
// Checkout
checkout scm
echo 'Upgrade python and install dependencies to avoid compiling from sources.'
sh 'apt-get update && apt-get -qq install python-pysqlite2 libldap2-dev libsasl2-dev rdiff-backup node-less'
sh 'pip install pip setuptools tox --upgrade'
}
stage("${image}-${env}:Build") {
echo 'Compile catalog and less'
sh 'python setup.py build'
}
stage("${image}-${env}:Test") {
try {
sh "tox --recreate --workdir /tmp --sitepackages -e ${env}"
} finally {
junit "nosetests-${env}.xml"
step([$class: 'CoberturaPublisher', coberturaReportFile: "coverage-${env}.xml"])
}
}
}
}
}
}}}
parallel builders
node {
stage ('Publish') {
if (env.BRANCH_NAME == 'master') {
// Wipe working directory to make sure to build clean.
deleteDir()
// Checkout
checkout scm
// Define version
def pyVersion = sh(
script: 'python setup.py --version | tail -n1',
returnStdout: true
).trim()
def version = pyVersion.replaceFirst(".dev.*", ".${BUILD_NUMBER}")
// Push changes to git
withCredentials([usernamePassword(credentialsId: 'gitlab-jenkins', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) {
sh """
sed -i.bak -r "s/version='(.*).dev.*'/version='${version}'/" setup.py
git config --local user.email "jenkins@patrikdufresne.com"
git config --local user.name "Jenkins"
git commit setup.py -m 'Release ${version}'
git tag '${version}'
git push http://${GIT_USERNAME}:${GIT_PASSWORD}@git.patrikdufresne.com/pdsl/rdiffweb.git --tags
"""
}
// Publish to pypi
docker.image("ikus060/docker-debian-py2-py3:jessie").inside {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'ikus060-pypi', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh """
cat > ~/.pypirc << EOF
[distutils]
index-servers =
pypi
[pypi]
username=${USERNAME}
password=${PASSWORD}
EOF
"""
writeFile file: "/root/.pypirc", text: """
"""
sh 'cat /root/.pypirc'
sh 'pip install wheel --upgrade'
sh 'python setup.py sdist bdist_wheel upload -r pypi'
}
}
}
}
}
\ No newline at end of file
......@@ -184,7 +184,7 @@ class AuthFormTool(BaseAuth):
return self.do_logout(**request.params)
# No special path, validate session.
logger.info('no special path, running do_check')
logger.debug('no special path, running do_check')
return self.do_check()
......
......@@ -169,7 +169,7 @@ if PY2:
setup(
name='rdiffweb',
version='0.10.6.dev1',
use_scm_version=True,
description='A web interface to rdiff-backup repositories',
author='Patrik Dufresne',
author_email='info@patrikdufresne.com',
......@@ -202,6 +202,7 @@ setup(
# required packages for build process
setup_requires=[
"babel>=0.9.6",
"setuptools_scm",
],
# requirement for testing
tests_require=[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment