source: Jenkinsfile @ b287f67

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since b287f67 was b287f67, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

fixed some errors with Jenkinsfile

  • logs are now attached on failures
  • cfa is now installed locally
  • Property mode set to 100644
File size: 2.1 KB
Line 
1
2
3node ('master'){
4
5        def err = null
6        def stage_name
7        def log_needed = false
8        currentBuild.result = "SUCCESS"
9
10        try {
11
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                        //configure the conpilation
23                        //Don't remove outputs for the clean and configure unless errors are present
24                        sh 'make clean > /dev/null'
25                        sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${env.WORKSPACE} > /dev/null"
26                        sh 'make -j 8'
27
28                stage 'Test'
29
30                        stage_name = 'Test'
31
32                        dir ('src/examples') {
33                                sh './runTests.sh'
34                        }
35
36                stage 'Cleanup'
37
38                        email("SUCCESS", false)
39        }
40
41        catch (Exception caughtError) {
42                err = caughtError
43                log_needed = true
44                currentBuild.result = "FAILURE"
45
46                switch(stage_name) {
47                        case 'Test' :
48                                currentBuild.result = "TEST FAILURE"
49                                break
50                        default :
51                                break
52                }
53        }
54
55        finally {
56                //Send email with final results
57                email(currentBuild.result, log_needed)
58
59                /* Must re-throw exception to propagate error */
60                if (err) {
61                        throw err
62                }
63        }
64}
65
66def email(String status, boolean log) {
67        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
68        //Configurations for email format
69        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
70
71        def email_subject = "[${project_name} git] UNNAMED PROJECT branch ${env.BRANCH_NAME} - Build # ${env.BUILD_NUMBER} - ${status}!"
72        def email_body = """    This is an automated email from the Jenkins build machine. It was
73        generated because of a git hooks/post-receive script following
74        a ref change was pushed to the repository containing
75        the project "UNNAMED PROJECT".
76
77        The branch ${env.BRANCH_NAME} has been updated.
78
79        Check console output at ${env.BUILD_URL} to view the results."""
80
81        // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
82        // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1]
83        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
84
85        //send email notification
86        emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
87}
Note: See TracBrowser for help on using the repository browser.