Projet

Général

Profil

0002-create-a-Jenkinsfile-24646.patch

Emmanuel Cazenave, 09 août 2018 17:33

Télécharger (3,06 ko)

Voir les différences:

Subject: [PATCH 2/2] create a Jenkinsfile (#24646)

 Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++
 pylint.sh   |  3 ---
 tox.ini     | 14 +++++++-------
 3 files changed, 43 insertions(+), 10 deletions(-)
 create mode 100644 Jenkinsfile
Jenkinsfile
1
@Library('eo-jenkins-lib@master') import eo.Utils
2

  
3
pipeline {
4
    agent any
5
    stages {
6
        stage('Unit Tests') {
7
            steps {
8
                sh 'tox -rv'
9
            }
10
        }
11
        stage('Packaging') {
12
            steps {
13
                script {
14
                    if (env.JOB_NAME == 'passerelle' && env.GIT_BRANCH == 'origin/master') {
15
                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d jessie,stretch passerelle'
16
                    }
17
                }
18
            }
19
        }
20
    }
21
    post {
22
        always {
23
            script {
24
                utils = new Utils()
25
                utils.mail_notify(currentBuild, env, 'admin+jenkins-passerelle@entrouvert.com')
26
                utils.publish_coverage('coverage.xml')
27
                utils.publish_coverage_native('index.html')
28
                utils.publish_pylint('pylint.out')
29
            }
30
            junit '*_results.xml'
31
        }
32
        success {
33
            cleanWs()
34
        }
35
    }
36
}
pylint.sh
10 10
	echo No pylint RC found
11 11
	exit 0
12 12
fi
13

  
14
test -f pylint.out && cp pylint.out pylint.out.prev
15 13
pylint -f parseable --rcfile ${PYLINT_RC} "$@" | tee pylint.out || /bin/true
16
test -f pylint.out.prev && (diff pylint.out.prev pylint.out | grep '^[><]' | grep .py) || /bin/true
tox.ini
1 1
[tox]
2
envlist = coverage-{django18,django111}-pylint
3
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/
2
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:BRANCH_NAME:}
3
envlist = django{18,111}
4 4

  
5 5
[testenv]
6
usedevelop =
7
  coverage: True
6
usedevelop = True
7
basepython = python2
8 8
setenv =
9 9
  DJANGO_SETTINGS_MODULE=passerelle.settings
10 10
  PASSERELLE_SETTINGS_FILE=tests/settings.py
11 11
  fast: FAST=--nomigrations
12
  coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=passerelle/ --cov-config .coveragerc
13 12
deps =
14 13
  django18: django>=1.8,<1.9
15 14
  django111: django>=1.11,<1.12
......
26 25
  lxml
27 26
  mohawk
28 27
commands =
29
  py.test {env:FAST:} {env:COVERAGE:} {posargs:tests/}
30
  pylint: ./pylint.sh passerelle/
28
  django18: py.test {posargs: {env:FAST:} --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=passerelle/ --cov-config .coveragerc tests/}
29
  django18: ./pylint.sh passerelle/
30
  django111: py.test {posargs: --junitxml=test_{envname}_results.xml tests/}
31
-