Changes in / [e24f13a:a3e7d34]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    re24f13a ra3e7d34  
    11
     2def build() {
     3        build_stage 'Checkout'
     4
     5                //checkout the source code and clean the repo
     6                sh 'rm -rf *'
     7                checkout scm
     8
     9        build_stage 'Build'
     10
     11                //Configure the conpilation (Output is not relevant)
     12                //Use the current directory as the installation target so nothing
     13                //escapes the sandbox
     14                //Also specify the compiler by hand
     15                def install_dir = pwd tmp: true
     16                sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"
     17
     18                //Compile the project
     19                sh 'make -j 8 install'
     20
     21        build_stage 'Test'
     22
     23                status_prefix = 'Test'
     24
     25                dir ('src/examples') {
     26                        sh './runTests.sh'
     27                }
     28
     29        build_stage 'Cleanup'
     30
     31                //install doesn't need to be cleaned since prefix uses temporary workspace
     32}
     33
     34def Compiler
     35
     36def build_stage(String name) {
     37        def stage_name = "${Compiler} ${name}"
     38        stage stage_name
     39
     40                status_prefix = stage_name
     41}
    242
    343node ('master'){
    444
    545        def err = null
    6         def stage_name
     46        def status_prefix
    747        def log_needed = false
    848        currentBuild.result = "SUCCESS"
    949
    1050        try {
     51                Compiler = 'gcc-4.9'
     52                build()
    1153
    12                 stage 'Checkout'
    13 
    14                         //checkout the source code and clean the repo
    15                         checkout scm
    16                         sh 'git clean -dfq'
    17 
    18                 stage 'Build'
    19 
    20                         stage_name = 'Build'
    21 
    22                         //Clean the directory (Output is not relevant)
    23                         sh 'make clean > /dev/null'
    24 
    25                         //Configure the conpilation (Output is not relevant)
    26                         //Use the current directory as the installation target so nothing
    27                         //escapes the sandbox
    28                         //Also specify the compiler by hand
    29                         def install_dir = pwd tmp: true
    30                         sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"
    31 
    32                         //Compile the project
    33                         sh 'make -j 8 install'
    34 
    35                 stage 'Test'
    36 
    37                         stage_name = 'Test'
    38 
    39                         dir ('src/examples') {
    40                                 sh './runTests.sh'
    41                         }
    42 
    43                 stage 'Cleanup'
    44 
    45                         //install doesn't need to be cleaned since prefix uses temporary workspace
    4654        }
    4755
     
    4957                err = caughtError
    5058                log_needed = true
    51                 currentBuild.result = "FAILURE"
    52 
    53                 switch(stage_name) {
    54                         case 'Test' :
    55                                 currentBuild.result = "TEST FAILURE"
    56                                 break
    57                         default :
    58                                 break
    59                 }
     59                currentBuild.result = "${status_prefix} FAILURE"
    6060        }
    6161
     
    7676        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    7777
    78         def email_subject = "[${project_name} git] UNNAMED PROJECT branch ${env.BRANCH_NAME} - Build # ${env.BUILD_NUMBER} - ${status}!"
    79         def email_body = """    This is an automated email from the Jenkins build machine. It was
    80         generated because of a git hooks/post-receive script following
    81         a ref change was pushed to the repository containing
    82         the project "UNNAMED PROJECT".
     78        def email_subject = "[${project_name} git][BUILD - ${status}!]Build # ${env.BUILD_NUMBER} - ${env.BRANCH_NAME}"
     79        def email_body = """This is an automated email from the Jenkins build machine. It was
     80generated because of a git hooks/post-receive script following
     81a ref change was pushed to the repository containing
     82the project "UNNAMED PROJECT".
    8383
    84         The branch ${env.BRANCH_NAME} has been updated.
     84The branch ${env.BRANCH_NAME} has been updated.
    8585
    86         Check console output at ${env.BUILD_URL} to view the results."""
     86Check console output at ${env.BUILD_URL} to view the results."""
    8787
    8888        // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
Note: See TracChangeset for help on using the changeset viewer.