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
RevLine 
[c9d651d]1
[77f347d]2def build() {
3 build_stage 'Checkout'
[c9d651d]4
[77f347d]5 //checkout the source code and clean the repo
6 sh 'rm -rf *'
7 checkout scm
[23a14d86]8
[77f347d]9 build_stage 'Build'
[7aebc62]10
[77f347d]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"
[fde808df]17
[77f347d]18 //Compile the project
19 sh 'make -j 8 install'
[fde808df]20
[77f347d]21 build_stage 'Test'
[fde808df]22
[77f347d]23 status_prefix = 'Test'
[fde808df]24
[77f347d]25 dir ('src/examples') {
26 sh './runTests.sh'
27 }
[fde808df]28
[77f347d]29 build_stage 'Cleanup'
[7359098]30
[77f347d]31 //install doesn't need to be cleaned since prefix uses temporary workspace
32}
[7359098]33
[77f347d]34def Compiler
[fde808df]35
[77f347d]36def build_stage(String name) {
37 def stage_name = "${Compiler} ${name}"
38 stage stage_name
[fde808df]39
[77f347d]40 status_prefix = stage_name
41}
[fde808df]42
[77f347d]43node ('master'){
[fde808df]44
[77f347d]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()
[fde808df]53
[f43a200]54 }
55
[fde808df]56 catch (Exception caughtError) {
57 err = caughtError
[b287f67]58 log_needed = true
[77f347d]59 currentBuild.result = "${status_prefix} FAILURE"
[fde808df]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 }
[d3d0069]70 }
[7aebc62]71}
[f2b977a]72
[19ad15b]73def email(String status, boolean log) {
[e8a22a7]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
[848fb00]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".
[e8a22a7]83
[848fb00]84The branch ${env.BRANCH_NAME} has been updated.
[e8a22a7]85
[848fb00]86Check console output at ${env.BUILD_URL} to view the results."""
[e8a22a7]87
[a6b7480]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"
[e8a22a7]91
92 //send email notification
[1e34653]93 emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
[e8a22a7]94}
Note: See TracBrowser for help on using the repository browser.