source: Jenkinsfile @ 992c26d

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 992c26d was 992c26d, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

added support for specifiying compilers to use in jenkins file

  • Property mode set to 100644
File size: 2.5 KB
Line 
1
2def build() {
3        build_stage 'Checkout'
4                def install_dir = pwd tmp: true
5                //checkout the source code and clean the repo
6                sh "rm -rf * ${install_dir}/*"
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                sh "./configure CXX=${currentCC.cpp-cc} --with-backend-compiler=${currentCC.cfa-backend-cc} --prefix=${install_dir} > /dev/null"
16
17                //Compile the project
18                sh 'make -j 8 install'
19
20        build_stage 'Test'
21
22                status_prefix = 'Test'
23
24                dir ('src/examples') {
25                        sh './runTests.sh'
26                }
27
28        build_stage 'Cleanup'
29
30                //install doesn't need to be cleaned since prefix uses temporary workspace
31}
32
33class CC_Desc {
34        String name
35        String cpp-cc
36        String cfa-backend-cc
37}
38
39def currentCC
40
41def build_stage(String name) {
42        def stage_name = "${currentCC.name} ${name}".trim()
43        stage stage_name
44
45                status_prefix = stage_name
46}
47
48node ('master'){
49
50        def err = null
51        def status_prefix
52        def log_needed = false
53        currentBuild.result = "SUCCESS"
54
55        try {
56                currentCC = ['gcc-4.9', 'g++-4.9', 'gcc-4.9'] as CC_Desc
57                build()
58
59        }
60
61        catch (Exception caughtError) {
62                err = caughtError
63                log_needed = true
64                currentBuild.result = "${status_prefix} FAILURE".trim()
65        }
66
67        finally {
68                //Send email with final results
69                email(currentBuild.result, log_needed)
70
71                /* Must re-throw exception to propagate error */
72                if (err) {
73                        throw err
74                }
75        }
76}
77
78def email(String status, boolean log) {
79        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
80        //Configurations for email format
81        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
82
83        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${status}] - branch ${env.BRANCH_NAME}"
84        def email_body = """This is an automated email from the Jenkins build machine. It was
85generated because of a git hooks/post-receive script following
86a ref change was pushed to the repository containing
87the project "UNNAMED PROJECT".
88
89The branch ${env.BRANCH_NAME} has been updated.
90
91Check console output at ${env.BUILD_URL} to view the results."""
92
93        // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
94        // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1]
95        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
96
97        //send email notification
98        emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
99}
Note: See TracBrowser for help on using the repository browser.