configure build in Jenkins2
This commit is contained in:
parent
7a54118a4d
commit
7b2f4f2f9a
|
@ -0,0 +1,39 @@
|
||||||
|
@Library('eo-jenkins-lib@master') import eo.Utils
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
stages {
|
||||||
|
stage('Unit Tests') {
|
||||||
|
steps {
|
||||||
|
sh './jenkins.sh'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Packaging') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
if (env.JOB_NAME == 'authentic2-auth-fc' && env.GIT_BRANCH == 'origin/master') {
|
||||||
|
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder authentic2-auth-fc'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
script {
|
||||||
|
utils = new Utils()
|
||||||
|
utils.mail_notify(currentBuild, env, 'admin+jenkins-authentic2-auth-fc@entrouvert.com')
|
||||||
|
utils.publish_coverage('coverage-*.xml')
|
||||||
|
utils.publish_coverage_native(
|
||||||
|
'index.html', 'htmlcov-coverage-dj18-pg', 'Coverage a2-auth-fc PG')
|
||||||
|
utils.publish_coverage_native(
|
||||||
|
'index.html', 'htmlcov-coverage-dj18-sqlite', 'Coverage a2-auth-fc SQLITE')
|
||||||
|
utils.publish_pylint('pylint.out')
|
||||||
|
}
|
||||||
|
junit 'junit-*.xml'
|
||||||
|
}
|
||||||
|
success {
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
for DIRECTORY in "htmlcov" "htmlcov-coverage-dj18-authentic-pg" "htmlcov-coverage-dj18-rbac-pg" "venv"
|
||||||
|
do
|
||||||
|
if [ -d "$DIRECTORY" ]; then
|
||||||
|
rm -r $DIRECTORY
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
virtualenv venv
|
||||||
|
venv/bin/pip install tox
|
||||||
|
venv/bin/tox -rv
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/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
|
||||||
|
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
|
17
tox.ini
17
tox.ini
|
@ -5,22 +5,25 @@
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic2-auth-fc/
|
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic2-auth-fc/
|
||||||
envlist = {coverage,nocoverage}-{dj18}-{pg,sqlite}
|
envlist = coverage-dj18-{pg,sqlite}
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
whitelist_externals =
|
||||||
|
/bin/mv
|
||||||
|
/bin/rm
|
||||||
setenv =
|
setenv =
|
||||||
AUTHENTIC2_SETTINGS_FILE=tests/settings.py
|
AUTHENTIC2_SETTINGS_FILE=tests/settings.py
|
||||||
DJANGO_SETTINGS_MODULE=authentic2.settings
|
DJANGO_SETTINGS_MODULE=authentic2.settings
|
||||||
sqlite: DB_ENGINE=django.db.backends.sqlite3
|
sqlite: DB_ENGINE=django.db.backends.sqlite3
|
||||||
pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
|
pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
|
||||||
coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov=src/ --cov-config .coveragerc
|
coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=src/ --cov-config .coveragerc
|
||||||
fast: FAST=--nomigrations
|
fast: FAST=--nomigrations
|
||||||
usedevelop =
|
usedevelop =
|
||||||
coverage: True
|
coverage: True
|
||||||
nocoverage: False
|
nocoverage: False
|
||||||
deps =
|
deps =
|
||||||
dj18: django>1.8,<1.9
|
dj18: django>1.8,<1.9
|
||||||
dj19: django>1.8,<1.9
|
dj18: django-tables2<1.1
|
||||||
pg: psycopg2
|
pg: psycopg2
|
||||||
coverage
|
coverage
|
||||||
pytest-cov
|
pytest-cov
|
||||||
|
@ -36,8 +39,12 @@ deps =
|
||||||
pyquery
|
pyquery
|
||||||
httmock
|
httmock
|
||||||
pytz
|
pytz
|
||||||
requests<=2.11.1
|
requests
|
||||||
../authentic2
|
git+https://git.entrouvert.org/authentic.git
|
||||||
commands =
|
commands =
|
||||||
./getlasso.sh
|
./getlasso.sh
|
||||||
py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
|
py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
|
||||||
|
coverage: mv coverage.xml coverage-{envname}.xml
|
||||||
|
coverage: rm -rf htmlcov-{envname}
|
||||||
|
coverage: mv htmlcov htmlcov-{envname}
|
||||||
|
coverage-dj111-pg: ./pylint.sh src/authentic2-auth-fc/
|
||||||
|
|
Reference in New Issue