build: add jenkinsfile
This commit is contained in:
parent
99a8987d6b
commit
59bb0a3116
|
@ -0,0 +1,43 @@
|
||||||
|
@Library('eo-jenkins-lib@master') import eo.Utils
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage('Unit Tests') {
|
||||||
|
steps {
|
||||||
|
sh 'tox -rv'
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
script {
|
||||||
|
utils = new Utils()
|
||||||
|
utils.publish_coverage('coverage.xml')
|
||||||
|
utils.publish_coverage_native('index.html')
|
||||||
|
utils.publish_pylint('pylint.out')
|
||||||
|
}
|
||||||
|
junit '*_results.xml'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Packaging') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
if (env.JOB_NAME == 'fargo' && env.GIT_BRANCH == 'origin/master') {
|
||||||
|
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder fargo'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
script {
|
||||||
|
utils = new Utils()
|
||||||
|
utils.mail_notify(currentBuild, env, 'admin+jenkins-fargo@entrouvert.com')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
success {
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e -x
|
||||||
|
env
|
||||||
|
if [ -f /var/lib/jenkins/pylint.django.rc ]; then
|
||||||
|
PYLINT_RC=/var/lib/jenkins/pylint.django.rc
|
||||||
|
elif [ -f pylint.django.rc ]; then
|
||||||
|
PYLINT_RC=pylint.django.rc
|
||||||
|
else
|
||||||
|
echo No pylint RC found
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
test -f pylint.out && cp pylint.out pylint.out.prev
|
||||||
|
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
|
||||||
|
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
|
13
tox.ini
13
tox.ini
|
@ -1,6 +1,6 @@
|
||||||
[tox]
|
[tox]
|
||||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/fargo/
|
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/fargo/{env:BRANCH_NAME:}
|
||||||
envlist = py2-coverage-dj18-sqlite,py2-coverage-dj111-sqlite,py2-coverage-dj18-pg,{py2,py3}-coverage-dj111-pg
|
envlist = py2-coverage-dj18-sqlite,py2-coverage-dj111-sqlite-pylint,py2-coverage-dj18-pg,{py2,py3}-coverage-dj111-pg
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
|
@ -11,7 +11,7 @@ setenv =
|
||||||
pg: DB_ENGINE=postgresql_psycopg2
|
pg: DB_ENGINE=postgresql_psycopg2
|
||||||
DJANGO_SETTINGS_MODULE=fargo.settings
|
DJANGO_SETTINGS_MODULE=fargo.settings
|
||||||
FARGO_SETTINGS_FILE=tests/settings.py
|
FARGO_SETTINGS_FILE=tests/settings.py
|
||||||
coverage: COVERAGE=--cov=fargo --cov-report xml
|
coverage: COVERAGE=--junitxml=test_results.xml --random --cov-report xml --cov-report html --cov=fargo/
|
||||||
deps =
|
deps =
|
||||||
dj18: django>=1.8,<1.9
|
dj18: django>=1.8,<1.9
|
||||||
dj18: django-tables2<1.1
|
dj18: django-tables2<1.1
|
||||||
|
@ -19,6 +19,8 @@ deps =
|
||||||
dj111: django-tables2>=1.5,<2.0
|
dj111: django-tables2>=1.5,<2.0
|
||||||
pytest>=3.3.0,<4.1
|
pytest>=3.3.0,<4.1
|
||||||
pg: psycopg2
|
pg: psycopg2
|
||||||
|
pylint<1.8
|
||||||
|
pylint-django<0.8.1
|
||||||
pytest-cov
|
pytest-cov
|
||||||
pytest-random
|
pytest-random
|
||||||
pytest-mock
|
pytest-mock
|
||||||
|
@ -29,6 +31,5 @@ deps =
|
||||||
djangorestframework>=3.3,<3.4
|
djangorestframework>=3.3,<3.4
|
||||||
mock
|
mock
|
||||||
commands =
|
commands =
|
||||||
py.test {env:COVERAGE:} {posargs:--random --junit-xml=junit-{envname}.xml tests}
|
py.test {env:COVERAGE:} {posargs:tests/}
|
||||||
coverage: mv coverage.xml coverage-{envname}.xml
|
pylint: ./pylint.sh fargo/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue