Rebase from 'remote/origin'

This commit is contained in:
Michael Bideau 2019-07-16 11:41:02 +02:00
commit 85e815f72b
9 changed files with 88 additions and 29 deletions

2
.coveragerc Normal file
View File

@ -0,0 +1,2 @@
[run]
omit = */south_migrations/*

4
.gitignore vendored
View File

@ -7,4 +7,6 @@
/dist
/build
/.pytest_cache
/test_*_results.xml
/test*_results.xml
/coverage.xml
/htmlcov

45
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,45 @@
@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 == 'passerelle-atreal-openads' && env.GIT_BRANCH == 'origin/master') {
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder passerelle-atreal-openads'
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d stretch --branch ${env.GIT_BRANCH} --hotfix passerelle-atreal-openads"
}
}
}
}
}
post {
always {
script {
utils = new Utils()
utils.mail_notify(currentBuild, env, 'admin+jenkins-passerelle-atreal-openads@entrouvert.com')
}
}
success {
cleanWs()
}
}
}

2
README
View File

@ -4,8 +4,6 @@ Passerelle connector to openADS
Installation
------------
- create a symbolik link from this module to the passerelle 'apps' directory
- add to Passerelle installed apps settings:
INSTALLED_APPS += ('atreal_openads',)

5
debian/control vendored
View File

@ -1,5 +1,5 @@
Source: passerelle-atreal-openads
Maintainer: Frederic Peters <fpeters@entrouvert.com>
Maintainer: Michael Bideau <mbideau+publik@atreal.fr>
Section: python
Priority: optional
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 9), python-django
@ -7,6 +7,7 @@ Standards-Version: 3.9.1
Package: python-passerelle-atreal-openads
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}
Depends: ${misc:Depends}, ${python:Depends},
python-magic
Description: Passerelle connector to openADS.API
.

16
pylint.sh Executable file
View File

@ -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

View File

@ -51,10 +51,10 @@ setup(
include_package_data=True,
packages=find_packages(),
cmdclass={
'sdist': eo_sdist,
'sdist': eo_sdist
},
scripts=['manage.py'],
install_requires=[
'python-magic',
'python-magic'
]
)

View File

@ -3,11 +3,10 @@ import os
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
if 'passerelle.apps.atreal_openads' in INSTALLED_APPS:
INSTALLED_APPS = tuple(x for x in INSTALLED_APPS if x != 'passerelle.apps.atreal_openads')
if 'atreal_openads' not in INSTALLED_APPS:
INSTALLED_APPS += ('atreal_openads',)
# include app
INSTALLED_APPS += (
'atreal_openads',
)
CACHES = {
'default': {

30
tox.ini
View File

@ -1,30 +1,26 @@
[tox]
envlist = py2-coverage-pylint
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle-atreal-openads/{env:BRANCH_NAME:}
envlist = django111-{sqlite,pg}
[testenv]
usedevelop = True
basepython = python2
usedevelop =
coverage: True
nocoverage: False
setenv =
DJANGO_SETTINGS_MODULE=passerelle.settings
PASSERELLE_SETTINGS_FILE=tests/settings.py
BRANCH_NAME={env:BRANCH_NAME:}
sqlite: DB_ENGINE=django.db.backends.sqlite3
pg: DB_ENGINE=django.db.backends.postgresql_psycopg2
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov-report html --cov=atreal_openads/
deps =
django111: django>=1.11,<1.12
psycopg2-binary
pytest
http://git.entrouvert.org/passerelle.git/snapshot/passerelle-master.tar.gz
pytest-cov
pytest-django<3.4.6
django-webtest<1.9.3
httmock
mock
pytest-django
pytest>=3.3.0,<4
WebTest
git+http://repos.entrouvert.org/passerelle.git/#egg=passerelle
python-magic
mock
httmock
pylint<1.8
pylint-django<0.8.1
django-webtest<1.9.3
commands =
django111: py.test {posargs: --junitxml=test_{envname}_results.xml --cov=atreal_openads/ -W ignore::django.utils.deprecation.RemovedInDjango20Warning -vv tests/}
py.test {env:COVERAGE:} {posargs:tests/}
pylint: ./pylint.sh atreal_openads/