source: Jenkinsfile@ 848fb00

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 848fb00 was 848fb00, checked in by Thierry Delisle <tdelisle@…>, 9 years ago

modified build email to make status more obvious

  • Property mode set to 100644
File size: 2.3 KB
Line 
1
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}
42
43node ('master'){
44
45 def err = null
46 def status_prefix
47 def log_needed = false
48 currentBuild.result = "SUCCESS"
49
50 try {
51 Compiler = 'gcc-4.9'
52 build()
53
54 }
55
56 catch (Exception caughtError) {
57 err = caughtError
58 log_needed = true
59 currentBuild.result = "${status_prefix} FAILURE"
60 }
61
62 finally {
63 //Send email with final results
64 email(currentBuild.result, log_needed)
65
66 /* Must re-throw exception to propagate error */
67 if (err) {
68 throw err
69 }
70 }
71}
72
73def email(String status, boolean log) {
74 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
75 //Configurations for email format
76 def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
77
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".
83
84The branch ${env.BRANCH_NAME} has been updated.
85
86Check console output at ${env.BUILD_URL} to view the results."""
87
88 // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
89 // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1]
90 def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
91
92 //send email notification
93 emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
94}
Note: See TracBrowser for help on using the repository browser.