Changeset 9beae23
- Timestamp:
- Feb 16, 2017, 11:50:58 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 0ef06b6
- Parents:
- f51ef6f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
rf51ef6f r9beae23 2 2 3 3 //=========================================================================================================== 4 // Main compilation routines5 //===========================================================================================================6 //Compilation script is done here but environnement set-up and error handling is done in main loop7 def cfa_build(boolean full_build, String flags) {8 build_stage 'Checkout'9 def install_dir = pwd tmp: true10 //checkout the source code and clean the repo11 checkout scm12 13 //Clean all temporary files to make sure no artifacts of the previous build remain14 sh 'git clean -fdqx'15 16 //Reset the git repo so no local changes persist17 sh 'git reset --hard'18 19 build_stage 'Build'20 21 //Configure the conpilation (Output is not relevant)22 //Use the current directory as the installation target so nothing23 //escapes the sandbox24 //Also specify the compiler by hand25 sh "./configure CXX=${currentCC.cpp_cc} ${flags} --with-backend-compiler=${currentCC.cfa_backend_cc} --prefix=${install_dir} --enable-silent-rules --quiet"26 27 //Compile the project28 sh 'make -j 8 --no-print-directory V=0 install'29 30 build_stage 'Test'31 32 //Run the tests from the tests directory33 if (full_build) {34 sh 'make -C src/tests all-tests debug=yes'35 sh 'make -C src/tests all-tests debug=no'36 }37 else {38 sh 'make -C src/tests'39 }40 41 build_stage 'Cleanup'42 43 //do a maintainer-clean to make sure we need to remake from scratch44 sh 'make maintainer-clean > /dev/null'45 }46 47 def make_doc() {48 def err = null49 50 try {51 sh 'make clean > /dev/null'52 sh 'make > /dev/null 2>&1'53 }54 55 catch (Exception caughtError) {56 //rethrow error later57 err = caughtError58 59 sh 'cat *.log'60 }61 62 finally {63 /* Must re-throw exception to propagate error */64 if (err) {65 throw err66 }67 }68 }69 70 def doc_build() {71 stage 'Documentation'72 73 status_prefix = 'Documentation'74 75 dir ('doc/user') {76 make_doc()77 }78 79 dir ('doc/refrat') {80 make_doc()81 }82 }83 84 def benchmark() {85 stage 'Benchmark'86 87 status_prefix = 'Documentation'88 89 // //We can't just write to a file outside our repo90 // //Copy the file locally using ssh91 // sh 'scp plg2.cs.uwaterloo.ca:/u/cforall/public_html/perf-history/concurrency.csv bench.csv'92 93 // //Then append to the local file94 // sh 'make -C src/benchmark csv-data >> bench.csv'95 96 // //Then publish the file again97 // sh 'scp bench.csv plg2.cs.uwaterloo.ca:/u/cforall/public_html/perf-history/concurrency.csv'98 }99 100 //===========================================================================================================101 // Helper classes/variables/routines to make the status and stage name easier to use102 //===========================================================================================================103 //Description of a compiler (Must be serializable since pipelines are persistent)104 class CC_Desc implements Serializable {105 public String cc_name106 public String cpp_cc107 public String cfa_backend_cc108 109 CC_Desc(String cc_name, String cpp_cc, String cfa_backend_cc) {110 this.cc_name = cc_name111 this.cpp_cc = cpp_cc112 this.cfa_backend_cc = cfa_backend_cc113 }114 }115 116 //Global Variables defining the compiler and at which point in the build we are117 // These variables are used but can't be declared before hand because of wierd scripting rules118 // @Field String currentCC119 // @Field String status_prefix120 121 //Wrapper to sync stage name and status name122 def build_stage(String name) {123 def stage_name = "${currentCC.cc_name} ${name}".trim()124 stage stage_name125 126 status_prefix = stage_name127 }128 129 //Helper routine to collect information about the git history130 def collect_git_info() {131 132 //create the temporary output directory in case it doesn't already exist133 def out_dir = pwd tmp: true134 sh "mkdir -p ${out_dir}"135 136 //parse git logs to find what changed137 gitRefName = env.BRANCH_NAME138 dir("../${gitRefName}@script") {139 sh "git reflog > ${out_dir}/GIT_COMMIT"140 }141 git_reflog = readFile("${out_dir}/GIT_COMMIT")142 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]143 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]144 }145 146 //===========================================================================================================147 4 // Main loop of the compilation 148 5 //=========================================================================================================== 149 6 node ('master'){ 150 7 8 boolean bIsSandbox = env.BRANCH_NAME == "jenkins-sandbox" 151 9 boolean bIsFullBuild 152 10 def err = null … … 156 14 157 15 try { 158 //Prevent the build from exceeding 30 minutes16 //Prevent the build from exceeding 60 minutes 159 17 timeout(60) { 160 18 … … 180 38 ]]) 181 39 182 bIsSandbox = env.BRANCH_NAME == "jenkins-sandbox"183 40 bIsFullBuild = isFullBuild == 'true' 184 41 architectureFlag = '' … … 246 103 247 104 //=========================================================================================================== 105 // Helper classes/variables/routines to make the status and stage name easier to use 106 //=========================================================================================================== 107 //Description of a compiler (Must be serializable since pipelines are persistent) 108 class CC_Desc implements Serializable { 109 public String cc_name 110 public String cpp_cc 111 public String cfa_backend_cc 112 113 CC_Desc(String cc_name, String cpp_cc, String cfa_backend_cc) { 114 this.cc_name = cc_name 115 this.cpp_cc = cpp_cc 116 this.cfa_backend_cc = cfa_backend_cc 117 } 118 } 119 120 //Global Variables defining the compiler and at which point in the build we are 121 // These variables are used but can't be declared before hand because of wierd scripting rules 122 // @Field String currentCC 123 // @Field String status_prefix 124 125 //Wrapper to sync stage name and status name 126 def build_stage(String name) { 127 def stage_name = "${currentCC.cc_name} ${name}".trim() 128 stage stage_name 129 130 status_prefix = stage_name 131 } 132 133 //Helper routine to collect information about the git history 134 def collect_git_info() { 135 136 //create the temporary output directory in case it doesn't already exist 137 def out_dir = pwd tmp: true 138 sh "mkdir -p ${out_dir}" 139 140 //parse git logs to find what changed 141 gitRefName = env.BRANCH_NAME 142 dir("../${gitRefName}@script") { 143 sh "git reflog > ${out_dir}/GIT_COMMIT" 144 } 145 git_reflog = readFile("${out_dir}/GIT_COMMIT") 146 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1] 147 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2] 148 } 149 150 //=========================================================================================================== 151 // Main compilation routines 152 //=========================================================================================================== 153 //Compilation script is done here but environnement set-up and error handling is done in main loop 154 def cfa_build(boolean full_build, String flags) { 155 build_stage 'Checkout' 156 def install_dir = pwd tmp: true 157 //checkout the source code and clean the repo 158 checkout scm 159 160 //Clean all temporary files to make sure no artifacts of the previous build remain 161 sh 'git clean -fdqx' 162 163 //Reset the git repo so no local changes persist 164 sh 'git reset --hard' 165 166 build_stage 'Build' 167 168 //Configure the conpilation (Output is not relevant) 169 //Use the current directory as the installation target so nothing 170 //escapes the sandbox 171 //Also specify the compiler by hand 172 sh "./configure CXX=${currentCC.cpp_cc} ${flags} --with-backend-compiler=${currentCC.cfa_backend_cc} --prefix=${install_dir} --enable-silent-rules --quiet" 173 174 //Compile the project 175 sh 'make -j 8 --no-print-directory V=0 install' 176 177 build_stage 'Test' 178 179 //Run the tests from the tests directory 180 if (full_build) { 181 sh 'make -C src/tests all-tests debug=yes' 182 sh 'make -C src/tests all-tests debug=no' 183 } 184 else { 185 sh 'make -C src/tests' 186 } 187 188 build_stage 'Cleanup' 189 190 //do a maintainer-clean to make sure we need to remake from scratch 191 sh 'make maintainer-clean > /dev/null' 192 } 193 194 def make_doc() { 195 def err = null 196 197 try { 198 sh 'make clean > /dev/null' 199 sh 'make > /dev/null 2>&1' 200 } 201 202 catch (Exception caughtError) { 203 //rethrow error later 204 err = caughtError 205 206 sh 'cat *.log' 207 } 208 209 finally { 210 /* Must re-throw exception to propagate error */ 211 if (err) { 212 throw err 213 } 214 } 215 } 216 217 def doc_build() { 218 stage 'Documentation' 219 220 status_prefix = 'Documentation' 221 222 dir ('doc/user') { 223 make_doc() 224 } 225 226 dir ('doc/refrat') { 227 make_doc() 228 } 229 } 230 231 def benchmark() { 232 stage 'Benchmark' 233 234 status_prefix = 'Documentation' 235 236 // //We can't just write to a file outside our repo 237 // //Copy the file locally using ssh 238 // sh 'scp plg2.cs.uwaterloo.ca:/u/cforall/public_html/perf-history/concurrency.csv bench.csv' 239 240 // //Then append to the local file 241 // sh 'make -C src/benchmark csv-data >> bench.csv' 242 243 // //Then publish the file again 244 // sh 'scp bench.csv plg2.cs.uwaterloo.ca:/u/cforall/public_html/perf-history/concurrency.csv' 245 } 246 247 //=========================================================================================================== 248 248 //Routine responsible of sending the email notification once the build is completed 249 249 //===========================================================================================================
Note: See TracChangeset
for help on using the changeset viewer.