Projet

Général

Profil

0001-create-a-Jenkinsfile-26226.patch

Emmanuel Cazenave, 07 septembre 2018 14:48

Télécharger (2,69 ko)

Voir les différences:

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

and test on django 1.11
 Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++
 jenkins.sh  |  9 ---------
 tox.ini     |  8 +++++---
 3 files changed, 40 insertions(+), 12 deletions(-)
 create mode 100644 Jenkinsfile
 delete mode 100755 jenkins.sh
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 == 'combo' && env.GIT_BRANCH == 'origin/master') {
15
                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d jessie,stretch bijoe'
16
                    }
17
                }
18
            }
19
        }
20
    }
21
    post {
22
        always {
23
            script {
24
                utils = new Utils()
25
                utils.mail_notify(currentBuild, env, 'admin+jenkins-bijoe@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
}
jenkins.sh
1
#!/bin/sh
2

  
3
set -e
4

  
5
rm -f coverage.xml
6
rm -f test_results.xml
7

  
8
pip install --upgrade tox
9
tox -r -e coverage-{dj18,dj19,dj110}
tox.ini
4 4
# and then run "tox" from this directory.
5 5

  
6 6
[tox]
7
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bijoe/
7
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/bijoe/{env:BRANCH_NAME:}
8 8
envlist = dj18,dj111
9 9

  
10 10
[testenv]
11 11
usedevelop = true
12
basepython = python2
12 13
setenv =
13 14
	DJANGO_SETTINGS_MODULE=bijoe.settings
14 15
	coverage: COVERAGE=--junit-xml=test_results.xml --cov=bijoe --cov-report xml 
......
24 25
	pytest-random
25 26
	pytest-django
26 27
	WebTest
27
	dj18,dj19,dj110: django-webtest<1.9.3
28
	django-webtest<1.9.3
28 29
commands =
29
	py.test {env:COVERAGE:} {posargs:--nomigrations --random tests}
30
        dj111: py.test {posargs: --junitxml=test_{envname}_results.xml --cov-report xml --cov-report html --cov=bijoe --random tests/}
31
        dj18: py.test {posargs: --junitxml=test_{envname}_results.xml --random tests/}
30
-