Projet

Général

Profil

0001-use-a-Jenkinsfile-29776.patch

Benjamin Dauvergne, 16 janvier 2019 12:12

Télécharger (5,02 ko)

Voir les différences:

Subject: [PATCH] use a Jenkinsfile (#29776)

 Jenkinsfile | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 jenkins.sh  | 17 ++++++++-------
 tox.ini     |  3 ++-
 3 files changed, 73 insertions(+), 9 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 './jenkins.sh'
9
            }
10
            post {
11
                always {
12
                    script {
13
                        utils = new Utils()
14
                        utils.publish_coverage('coverage-*.xml')
15
                        utils.publish_coverage_native(
16
                            'index.html', 'htmlcov-coverage-django18-authentic', 'Coverage authentic tests')
17
                        utils.publish_coverage_native(
18
                            'index.html', 'htmlcov-coverage-django18-hobo', 'Coverage hobo tests')
19
                        utils.publish_coverage_native(
20
                            'index.html', 'htmlcov-coverage-django18-authentic', 'Coverage multipublik tests')
21
                        utils.publish_coverage_native(
22
                            'index.html', 'htmlcov-coverage-django18-authentic', 'Coverage multitenant tests')
23
                        utils.publish_coverage_native(
24
                            'index.html', 'htmlcov-coverage-django18-authentic', 'Coverage passerelle tests')
25
                        utils.publish_coverage_native(
26
                            'index.html', 'htmlcov-coverage-django111-authentic', 'Coverage authentic tests')
27
                        utils.publish_coverage_native(
28
                            'index.html', 'htmlcov-coverage-django111-hobo', 'Coverage hobo tests')
29
                        utils.publish_coverage_native(
30
                            'index.html', 'htmlcov-coverage-django111-authentic', 'Coverage multipublik tests')
31
                        utils.publish_coverage_native(
32
                            'index.html', 'htmlcov-coverage-django111-authentic', 'Coverage multitenant tests')
33
                        utils.publish_coverage_native(
34
                            'index.html', 'htmlcov-coverage-django111-authentic', 'Coverage passerelle tests')
35
                        utils.publish_pylint('pylint.out')
36
                    }
37
                    junit 'junit-*.xml'
38
                }
39
            }
40
        }
41
        stage('Packaging') {
42
            steps {
43
                script {
44
                    if (env.JOB_NAME == 'hobo' && env.GIT_BRANCH == 'origin/master') {
45
                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder hobo'
46
                    }
47
                }
48
            }
49
        }
50
    }
51
    post {
52
        always {
53
            script {
54
                utils = new Utils()
55
                utils.mail_notify(currentBuild, env, 'admin+jenkins-hobo@entrouvert.com')
56
            }
57
        }
58
        success {
59
            cleanWs()
60
        }
61
    }
62
}
jenkins.sh
4 4

  
5 5
rm -f *coverage.xml
6 6
rm -f *test_results.xml
7
rm -f htmlcov htmlcov-*
7 8

  
8
./getlasso.sh
9
pip install --upgrade setuptools
10
pip install --upgrade pip
11
pip install --upgrade pylint pylint-django
12
pip install --upgrade tox
9
virtualenv venv
10
venv/bin/pip install --upgrade setuptools
11
venv/bin/pip install --upgrade pip
12
venv/bin/pip install --upgrade pylint pylint-django
13
venv/bin/pip install --upgrade tox
13 14

  
14
tox -r
15
venv/bin/tox -rv
15 16

  
16
./merge-junit-results.py junit-*.xml >test_results.xml
17
./merge-coverage.py -o coverage.xml coverage-*.xml
17
# ./merge-junit-results.py junit-*.xml >test_results.xml
18
#./merge-coverage.py -o coverage.xml coverage-*.xml
18 19

  
19 20

  
20 21
test -f pylint.out && cp pylint.out pylint.out.prev
tox.ini
24 24
	passerelle: DEBIAN_CONFIG_COMMON=debian/debian_config_common.py
25 25
	passerelle: PASSERELLE_SETTINGS_FILE=tests_passerelle/settings.py
26 26
	passerelle: DJANGO_SETTINGS_MODULE=passerelle.settings
27
	coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov=hobo/ --cov-config .coveragerc
27
	coverage: COVERAGE=--junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=hobo/ --cov-config .coveragerc
28 28
	fast: NOMIGRATIONS=--nomigrations
29 29
deps:
30 30
	django18: django>=1.8,<1.9
......
59 59
	authentic: py.test {env:FAST:} {env:COVERAGE:} {env:NOMIGRATIONS:} {posargs:tests_authentic/}
60 60
	passerelle: py.test {env:COVERAGE:} {env:NOMIGRATIONS:} {posargs:tests_passerelle/}
61 61
	coverage: mv coverage.xml coverage-{envname}.xml
62
	coverage: mv htmlcov htmlcov-{envname}
62
-