source: Jenkinsfile@ 992c26d

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 stuck-waitfor-destruct with_gc
Last change on this file since 992c26d was 992c26d, checked in by Thierry Delisle <tdelisle@…>, 10 years ago

added support for specifiying compilers to use in jenkins file

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[c9d651d]1
[77f347d]2def build() {
3 build_stage 'Checkout'
[992c26d]4 def install_dir = pwd tmp: true
[77f347d]5 //checkout the source code and clean the repo
[992c26d]6 sh "rm -rf * ${install_dir}/*"
[77f347d]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
[992c26d]15 sh "./configure CXX=${currentCC.cpp-cc} --with-backend-compiler=${currentCC.cfa-backend-cc} --prefix=${install_dir} > /dev/null"
[fde808df]16
[77f347d]17 //Compile the project
18 sh 'make -j 8 install'
[fde808df]19
[77f347d]20 build_stage 'Test'
[fde808df]21
[77f347d]22 status_prefix = 'Test'
[fde808df]23
[77f347d]24 dir ('src/examples') {
25 sh './runTests.sh'
26 }
[fde808df]27
[77f347d]28 build_stage 'Cleanup'
[7359098]29
[77f347d]30 //install doesn't need to be cleaned since prefix uses temporary workspace
31}
[7359098]32
[992c26d]33class CC_Desc {
34 String name
35 String cpp-cc
36 String cfa-backend-cc
37}
38
39def currentCC
[fde808df]40
[77f347d]41def build_stage(String name) {
[992c26d]42 def stage_name = "${currentCC.name} ${name}".trim()
[77f347d]43 stage stage_name
[fde808df]44
[77f347d]45 status_prefix = stage_name
46}
[fde808df]47
[77f347d]48node ('master'){
[fde808df]49
[77f347d]50 def err = null
51 def status_prefix
52 def log_needed = false
53 currentBuild.result = "SUCCESS"
54
55 try {
[992c26d]56 currentCC = ['gcc-4.9', 'g++-4.9', 'gcc-4.9'] as CC_Desc
[77f347d]57 build()
[fde808df]58
[f43a200]59 }
60
[fde808df]61 catch (Exception caughtError) {
62 err = caughtError
[b287f67]63 log_needed = true
[992c26d]64 currentBuild.result = "${status_prefix} FAILURE".trim()
[fde808df]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 }
[d3d0069]75 }
[7aebc62]76}
[f2b977a]77
[19ad15b]78def email(String status, boolean log) {
[e8a22a7]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
[992c26d]83 def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${status}] - branch ${env.BRANCH_NAME}"
[848fb00]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".
[e8a22a7]88
[848fb00]89The branch ${env.BRANCH_NAME} has been updated.
[e8a22a7]90
[848fb00]91Check console output at ${env.BUILD_URL} to view the results."""
[e8a22a7]92
[a6b7480]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"
[e8a22a7]96
97 //send email notification
[1e34653]98 emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
[e8a22a7]99}
Note: See TracBrowser for help on using the repository browser.