Projet

Général

Profil

0001-create-a-Jenkinsfile-26940.patch

Emmanuel Cazenave, 03 octobre 2018 10:24

Télécharger (2,16 ko)

Voir les différences:

Subject: [PATCH] create a Jenkinsfile (#26940)

 Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++
 tox.ini     |  8 +++++---
 2 files changed, 40 insertions(+), 3 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 == 'eopayment' && env.GIT_BRANCH == 'origin/master') {
15
                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder eopayment'
16
                    }
17
                }
18
            }
19
        }
20
    }
21
    post {
22
        always {
23
            script {
24
                utils = new Utils()
25
                utils.mail_notify(currentBuild, env, 'admin+jenkins-eopayment@entrouvert.com')
26
                utils.publish_coverage('coverage.xml')
27
                utils.publish_coverage_native('index.html')
28
            }
29
            junit '*_results.xml'
30
        }
31
        success {
32
            cleanWs()
33
        }
34
    }
35
}
tox.ini
5 5

  
6 6
[tox]
7 7
envlist = py2,py3
8
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/eopayment/
8
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/eopayment/{env:BRANCH_NAME:}
9 9

  
10 10
[testenv]
11 11
# django.contrib.auth is not tested it does not work with our templates
12
basepython = python2
12 13
commands =
13
  py.test --junitxml=junit.xml --cov-report xml --cov=eopayment/ tests
14
  py2: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=eopayment/ tests}
15
  py3: py.test {posargs: --junitxml=test_{envname}_results.xml tests}
14 16
usedevelop = True
15 17
deps = coverage
16 18
  pytest
17
  pytest-cov
19
  py2: pytest-cov
18
-