Jenkinsfile 1.95 KB
Newer Older
1 2 3
pipeline {

    agent any
4 5 6 7
    tools {
        maven 'mvn-default'
        jdk   'openjdk-8'
    }
8 9

    options {
10
        timeout(time: 60, unit: 'MINUTES')
11 12 13 14 15 16 17 18 19 20 21 22
    }

    stages {

        stage('Cleaning') {
            steps {
                sh 'git clean -fdx'
            }
        }

        stage('Build') {
            steps {
23 24 25 26 27 28
                script {
                    if ( env.BRANCH_NAME ==~ /^release-[.0-9]+$/ ) {
                        sh 'mvn verify assembly:single'
                    }
                    else {
                        sh 'mvn verify site'
29 30 31 32 33 34 35 36 37 38 39 40 41 42
                    }
                }
            }
        }
    }

    post {
        always {
            archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
            script {
                if ( env.BRANCH_NAME ==~ /^release-[.0-9]+$/ ) {
                    archiveArtifacts artifacts: 'target/*.zip', fingerprint: true
                }
            }
43
            junit testResults: '**/target/surefire-reports/*.xml'
44 45 46 47 48 49 50 51 52 53 54
            jacoco execPattern: 'target/**.exec',
                   classPattern: '**/classes',
                   sourcePattern: '**/src/main/java',
                   exclusionPattern: 'fr/cs/examples/**/*.class',
                   changeBuildStatus: true,
                   minimumBranchCoverage: '80', maximumBranchCoverage: '85',
                   minimumClassCoverage: '95', maximumClassCoverage: '100',
                   minimumComplexityCoverage: '80', maximumComplexityCoverage: '85',
                   minimumInstructionCoverage: '85', maximumInstructionCoverage: '90',
                   minimumLineCoverage: '85', maximumLineCoverage: '90',
                   minimumMethodCoverage: '90', maximumMethodCoverage: '95'
55 56 57
            recordIssues enabledForFailure: true, tools: [mavenConsole(), java(), javaDoc()]
            recordIssues enabledForFailure: true, tool:  checkStyle()
            recordIssues enabledForFailure: true, tool:  spotBugs()
58 59 60
        }
    }
}