Changeset 95fdb0a for Jenkinsfile
- Timestamp:
- Feb 22, 2017, 1:19:43 PM (7 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:
- bd34bcf5
- Parents:
- f31cb3e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
rf31cb3e r95fdb0a 10 10 def log_needed = false 11 11 12 bIsFullBuild = false 13 architectureFlag = '' 14 status_prefix = '' 12 compiler = compiler_from_params() 13 architecture = architecture_from_params() 14 15 do_alltests = param_allTests .toBoolean() 16 do_benchmark = param_benchmark .toBoolean() 17 do_doc = param_doc .toBoolean() 18 do_publish 15 19 16 20 currentBuild.result = "SUCCESS" 17 21 18 22 try { 19 //Prevent the build from exceeding 60 minutes 20 timeout(60) { 21 22 //Wrap build to add timestamp to command line 23 wrap([$class: 'TimestamperBuildWrapper']) { 23 //Wrap build to add timestamp to command line 24 wrap([$class: 'TimestamperBuildWrapper']) { 25 26 //Prevent the build from exceeding 60 minutes 27 timeout(60) { 28 29 notify() 24 30 25 31 prepare_build() 26 32 27 //Compile using gcc-4.9 28 currentCC = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9') 29 cfa_build(bIsFullBuild, architectureFlag) 30 31 //Compile latex documentation 32 doc_build() 33 34 if( bIsFullBuild ) { 35 //Compile using gcc-5 36 currentCC = new CC_Desc('gcc-5', 'g++-5', 'gcc-5') 37 cfa_build(true, architectureFlag) 38 39 //Compile using gcc-4.9 40 currentCC = new CC_Desc('gcc-6', 'g++-6', 'gcc-6') 41 cfa_build(true, architectureFlag) 42 } 33 checkout() 34 35 build() 36 37 test() 38 39 benchmark() 40 41 clean() 42 43 build_doc() 44 45 publish() 46 47 notify() 43 48 } 44 49 } … … 62 67 63 68 //Send email with final results if this is not a full build 64 if( ! bIsFullBuild&& !bIsSandbox ) {69 if( !do_sendemail && !bIsSandbox ) { 65 70 echo 'Notifying users of result' 66 71 email(currentBuild.result, log_needed) … … 75 80 76 81 //=========================================================================================================== 77 // Helper classes/variables/routines to make the status and stage name easier to use82 // Helper classes/variables/routines 78 83 //=========================================================================================================== 79 84 //Description of a compiler (Must be serializable since pipelines are persistent) … … 90 95 } 91 96 92 //Global Variables defining the compiler and at which point in the build we are93 // These variables are used but can't be declared before hand because of wierd scripting rules94 // @Field String currentCC95 // @Field String status_prefix96 97 //Wrapper to sync stage name and status name98 def build_stage(String name) {99 def stage_name = "${currentCC.cc_name} ${name}".trim()100 stage stage_name101 102 status_prefix = stage_name103 }104 105 97 //Helper routine to collect information about the git history 106 98 def collect_git_info() { … … 121 113 122 114 def prepare_build() { 123 properties ([ \ 124 [$class: 'ParametersDefinitionProperty', \ 125 parameterDefinitions: [ \ 126 [$class: 'BooleanParameterDefinition', \ 127 defaultValue: false, \ 128 description: 'If true, the build will be promoted to the do-lang git repository (on successful builds only)', \ 129 name: 'isFullBuild' \ 130 ], \ 131 [$class: 'ChoiceParameterDefinition', \ 132 choices: '64-bit\n32-bit', \ 133 defaultValue: '64-bit', \ 134 description: 'The architecture to use for compilation', \ 135 name: 'buildArchitecture' \ 136 ]] \ 115 properties ([ \ 116 [$class: 'ParametersDefinitionProperty', \ 117 parameterDefinitions: [ \ 118 [$class: 'ChoiceParameterDefinition', \ 119 description: 'Which compiler to use', \ 120 name: 'param_compiler', \ 121 choices: 'gcc-6\ngcc-5\ngcc-4.9\nclang', \ 122 defaultValue: 'gcc-6', \ 123 ], \ 124 [$class: 'ChoiceParameterDefinition', \ 125 description: 'The target architecture', \ 126 name: 'param_arch', \ 127 choices: '64-bit\n32-bit', \ 128 defaultValue: '64-bit', \ 129 ], \ 130 [$class: 'BooleanParameterDefinition', \ 131 description: 'If false, only the quick test suite is ran', \ 132 name: 'param_allTests', \ 133 defaultValue: false, \ 134 ], \ 135 [$class: 'BooleanParameterDefinition', \ 136 description: 'If true, jenkins also runs benchmarks', \ 137 name: 'param_benchmark', \ 138 defaultValue: false, \ 139 ], \ 140 [$class: 'BooleanParameterDefinition', \ 141 description: 'If true, jenkins also builds documentation', \ 142 name: 'param_doc', \ 143 defaultValue: false, \ 144 ], \ 145 [$class: 'BooleanParameterDefinition', \ 146 description: 'If true, jenkins also publishes results', \ 147 name: 'param_publish', \ 148 defaultValue: false, \ 149 ], \ 150 ], 137 151 ]]) 138 152 139 bIsFullBuild = isFullBuild == 'true' 140 architectureFlag = '' 141 if (buildArchitecture == '64-bit') { 142 architectureFlag = '--host=x86_64 CXXFLAGS="-m64" CFAFLAGS="-m64"' 143 } else if (buildArchitecture == '32-bit'){ 144 architectureFlag = '--host=i386 CXXFLAGS="-m32" CFAFLAGS="-m32"' 145 } else { 146 architectureFlag = 'ERROR' 147 } 148 149 echo "FULL BUILD = ${isFullBuild}\nArchitecture = ${buildArchitecture} (flag ${architectureFlag})" 153 compiler = compiler_from_params() 154 architecture = architecture_from_params() 155 156 do_alltests = param_allTests .toBoolean() 157 do_benchmark = param_benchmark .toBoolean() 158 do_doc = param_doc .toBoolean() 159 do_publish = param_publish .toBoolean() 150 160 151 161 collect_git_info() 152 162 } 163 164 def notify() { 165 sh 'curl --data "" http://plg2:8082/jenkins/notify' 166 } 167 168 def make_doc() { 169 def err = null 170 try { 171 sh 'make clean > /dev/null' 172 sh 'make > /dev/null 2>&1' 173 } 174 catch (Exception caughtError) { 175 err = caughtError //rethrow error later 176 sh 'cat *.log' 177 } 178 finally { 179 if (err) throw err // Must re-throw exception to propagate error 180 } 153 181 } 154 182 … … 157 185 //=========================================================================================================== 158 186 //Compilation script is done here but environnement set-up and error handling is done in main loop 159 def cfa_build(boolean full_build, String flags) { 160 build_stage 'Checkout' 161 def install_dir = pwd tmp: true 187 def checkout() { 188 stage 'Checkout' 162 189 //checkout the source code and clean the repo 163 190 checkout scm … … 168 195 //Reset the git repo so no local changes persist 169 196 sh 'git reset --hard' 170 171 build_stage 'Build' 172 197 } 198 199 def build() { 200 stage 'Build' 201 202 def install_dir = pwd tmp: true 203 173 204 //Configure the conpilation (Output is not relevant) 174 205 //Use the current directory as the installation target so nothing 175 206 //escapes the sandbox 176 207 //Also specify the compiler by hand 177 sh "./configure CXX=${c urrentCC.cpp_cc} ${flags} --with-backend-compiler=${currentCC.cfa_backend_cc} --prefix=${install_dir} --enable-silent-rules --quiet"208 sh "./configure CXX=${compiler.cpp_cc} ${architecture} --with-backend-compiler=${compiler.cfa_backend_cc} --prefix=${install_dir} --enable-silent-rules --quiet" 178 209 179 210 //Compile the project 180 211 sh 'make -j 8 --no-print-directory V=0 install' 181 182 build_stage 'Test' 212 } 213 214 def test() { 215 stage 'Test' 183 216 184 217 //Run the tests from the tests directory 185 if ( full_build) {218 if ( do_alltests ) { 186 219 sh 'make -C src/tests all-tests debug=yes' 187 220 sh 'make -C src/tests all-tests debug=no' … … 190 223 sh 'make -C src/tests' 191 224 } 192 193 build_stage 'Benchmark' 225 } 226 227 def benchmark() { 228 stage 'Benchmark' 229 230 if( !do_bencmark ) return 194 231 195 232 //Write the commit id to Benchmark … … 198 235 //Append bench results 199 236 sh 'make -C src/benchmark --no-print-directory csv-data >> bench.csv' 200 201 //Then publish the results 202 sh 'curl --data @bench.csv http://plg2/~cforall/cgi-bin/publish.cgi' 203 204 build_stage 'Cleanup' 237 } 238 239 def clean() { 240 stage 'Cleanup' 205 241 206 242 //do a maintainer-clean to make sure we need to remake from scratch … … 208 244 } 209 245 210 def make_doc() { 211 def err = null 212 213 try { 214 sh 'make clean > /dev/null' 215 sh 'make > /dev/null 2>&1' 216 } 217 218 catch (Exception caughtError) { 219 //rethrow error later 220 err = caughtError 221 222 sh 'cat *.log' 223 } 224 225 finally { 226 /* Must re-throw exception to propagate error */ 227 if (err) { 228 throw err 229 } 230 } 231 } 232 233 def doc_build() { 246 def build_doc() { 234 247 stage 'Documentation' 235 248 236 status_prefix = 'Documentation'249 if( !do_doc ) return 237 250 238 251 dir ('doc/user') { … … 243 256 make_doc() 244 257 } 258 } 259 260 def publish() { 261 stage 'Publish' 262 263 if( !do_publish ) return 264 265 //Then publish the results 266 sh 'curl --data @bench.csv http://plg2:8082/jenkins/publish' 245 267 } 246 268
Note: See TracChangeset
for help on using the changeset viewer.