Commit 85447a35 authored by Patrik Dufresne's avatar Patrik Dufresne

Create a Jenkinsfile

parent b35ebbd4
......@@ -21,8 +21,8 @@ pip-log.txt
# Unit test / coverage reports
.coverage
.tox
coverage.xml
nosetests.xml
coverage*.xml
nosetests*.xml
#Translations
*.mo
......
......@@ -18,6 +18,9 @@ env:
- CHERRYPY=9
- CHERRYPY=10
- CHERRYPY=11
- CHERRYPY=12
- CHERRYPY=13
- CHERRYPY=14
# Make sure to exclude python3.4 + CherryPy 3.2.2
# This configuration is not supported.
......
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 'Enforce timezone for tests to work.'
sh 'ln -snf /usr/share/zoneinfo/America/Montreal /etc/localtime && echo "America/Montreal" > /etc/timezone'
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
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2014 rdiffweb contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CherryPy>=3.5.0
Jinja2>=2.6
babel>=1.3
future>=0.15.2
pycrypto>=2.6.1
mock>=1.3.0
psutil>=2.1.1
\ No newline at end of file
......@@ -281,7 +281,6 @@ setup(
],
# requirement for testing
tests_require=[
"tox",
"mock>=1.3.0",
"coverage>=4.0.1",
"mockldap>=0.2.6",
......
......@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
[tox]
envlist = py{27,34}-cherrypy{35,4,5,6,7,8,9,10,11},py27-cherrypy32
envlist = py{27,3}-cherrypy{35,4,5,6,7,8,9,10,11},py27-cherrypy32
[testenv]
deps=
......@@ -31,7 +31,10 @@ deps=
cherrypy9: cherrypy>=9.0.0,<10.0.0
cherrypy10: cherrypy>=10.0.0,<11.0.0
cherrypy11: cherrypy>=11.0.0,<12.0.0
commands=python setup.py nosetests --xunit-file=nosetests-{envname}.xml --xunit-testsuite-name={envname}
cherrypy12: cherrypy>=12.0.0,<13.0.0
cherrypy13: cherrypy>=13.0.0,<14.0.0
cherrypy14: cherrypy>=14.0.0,<15.0.0
commands=python setup.py nosetests --xunit-file=nosetests-{envname}.xml --xunit-testsuite-name={envname} --cover-xml-file=coverage-{envname}.xml
[travis:env]
CHERRYPY =
......@@ -44,4 +47,7 @@ CHERRYPY =
8: cherrypy8
9: cherrypy9
10: cherrypy10
11: cherrypy11
\ No newline at end of file
11: cherrypy11
12: cherrypy12
13: cherrypy13
14: cherrypy14
\ No newline at end of file
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