[a63ad80] | 1 | #!groovy
|
---|
| 2 |
|
---|
[7a230fd] | 3 | import groovy.transform.Field
|
---|
| 4 |
|
---|
[8ecb590] | 5 | // For skipping stages
|
---|
| 6 | import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
|
---|
| 7 |
|
---|
[29f4fe62] | 8 | //===========================================================================================================
|
---|
[9beae23] | 9 | // Main loop of the compilation
|
---|
[29f4fe62] | 10 | //===========================================================================================================
|
---|
[56a9ce6] | 11 |
|
---|
[85142648] | 12 | node('master') {
|
---|
| 13 | // Globals
|
---|
| 14 | BuildDir = pwd tmp: true
|
---|
| 15 | SrcDir = pwd tmp: false
|
---|
| 16 | Settings = null
|
---|
| 17 | StageName = ''
|
---|
[4f9e706] | 18 |
|
---|
[85142648] | 19 | // Local variables
|
---|
| 20 | def err = null
|
---|
| 21 | def log_needed = false
|
---|
[5b8413b4] | 22 |
|
---|
[85142648] | 23 | currentBuild.result = "SUCCESS"
|
---|
[4f9e706] | 24 |
|
---|
[85142648] | 25 | try {
|
---|
| 26 | //Wrap build to add timestamp to command line
|
---|
| 27 | wrap([$class: 'TimestamperBuildWrapper']) {
|
---|
[0ef06b6] | 28 |
|
---|
[85142648] | 29 | Settings = prepare_build()
|
---|
[952ee7a] | 30 |
|
---|
[85142648] | 31 | node(Settings.Architecture.node) {
|
---|
| 32 | BuildDir = pwd tmp: true
|
---|
| 33 | SrcDir = pwd tmp: false
|
---|
[23a14d86] | 34 |
|
---|
[85142648] | 35 | clean()
|
---|
[7aebc62] | 36 |
|
---|
[85142648] | 37 | checkout()
|
---|
[fde808df] | 38 |
|
---|
[85142648] | 39 | build()
|
---|
[95fdb0a] | 40 |
|
---|
[85142648] | 41 | test()
|
---|
[95fdb0a] | 42 |
|
---|
[85142648] | 43 | benchmark()
|
---|
[95fdb0a] | 44 |
|
---|
[85142648] | 45 | build_doc()
|
---|
[7359098] | 46 |
|
---|
[85142648] | 47 | publish()
|
---|
| 48 | }
|
---|
[9beae23] | 49 |
|
---|
[85142648] | 50 | // Update the build directories when exiting the node
|
---|
| 51 | BuildDir = pwd tmp: true
|
---|
| 52 | SrcDir = pwd tmp: false
|
---|
[9beae23] | 53 | }
|
---|
[738cf8f] | 54 | }
|
---|
| 55 |
|
---|
[85142648] | 56 | //If an exception is caught we need to change the status and remember to
|
---|
| 57 | //attach the build log to the email
|
---|
| 58 | catch (Exception caughtError) {
|
---|
| 59 | //rethrow error later
|
---|
| 60 | err = caughtError
|
---|
[738cf8f] | 61 |
|
---|
[85142648] | 62 | echo err.toString()
|
---|
[e966ec0] | 63 |
|
---|
[85142648] | 64 | //An error has occured, the build log is relevent
|
---|
| 65 | log_needed = true
|
---|
[9beae23] | 66 |
|
---|
[85142648] | 67 | //Store the result of the build log
|
---|
| 68 | currentBuild.result = "${StageName} FAILURE".trim()
|
---|
| 69 | }
|
---|
[738cf8f] | 70 |
|
---|
[85142648] | 71 | finally {
|
---|
| 72 | //Send email with final results if this is not a full build
|
---|
| 73 | email(log_needed)
|
---|
[9beae23] | 74 |
|
---|
[85142648] | 75 | echo 'Build Completed'
|
---|
[734891d] | 76 |
|
---|
[85142648] | 77 | /* Must re-throw exception to propagate error */
|
---|
| 78 | if (err) {
|
---|
| 79 | throw err
|
---|
| 80 | }
|
---|
[738cf8f] | 81 | }
|
---|
| 82 | }
|
---|
[29f4fe62] | 83 | //===========================================================================================================
|
---|
[9beae23] | 84 | // Main compilation routines
|
---|
[29f4fe62] | 85 | //===========================================================================================================
|
---|
[0dc3ac3] | 86 | def clean() {
|
---|
[6c55a3d] | 87 | build_stage('Cleanup', true) {
|
---|
[0dc3ac3] | 88 | // clean the build by wipping the build directory
|
---|
[5b8413b4] | 89 | dir(BuildDir) {
|
---|
[d4cd491] | 90 | deleteDir()
|
---|
[ece8a80] | 91 | }
|
---|
[620dd2b] | 92 | }
|
---|
[95fdb0a] | 93 | }
|
---|
[29f4fe62] | 94 |
|
---|
[0dc3ac3] | 95 | //Compilation script is done here but environnement set-up and error handling is done in main loop
|
---|
| 96 | def checkout() {
|
---|
[6c55a3d] | 97 | build_stage('Checkout', true) {
|
---|
[0dc3ac3] | 98 | //checkout the source code and clean the repo
|
---|
[a336d46] | 99 | final scmVars = checkout scm
|
---|
| 100 | Settings.GitNewRef = scmVars.GIT_COMMIT
|
---|
| 101 | Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT
|
---|
[d3a4564a] | 102 |
|
---|
[a336d46] | 103 | echo GitLogMessage()
|
---|
[0dc3ac3] | 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
[95fdb0a] | 107 | def build() {
|
---|
[e507c11] | 108 | debug = true
|
---|
| 109 | release = Settings.RunAllTests || Settings.RunBenchmark
|
---|
| 110 | build_stage('Build : configure', true) {
|
---|
[dcf1979] | 111 | // Configure must be run inside the tree
|
---|
| 112 | dir (SrcDir) {
|
---|
| 113 | // Generate the necessary build files
|
---|
| 114 | sh './autogen.sh'
|
---|
| 115 | }
|
---|
| 116 |
|
---|
[50f2cfc] | 117 | // Build outside of the src tree to ease cleaning
|
---|
[5b8413b4] | 118 | dir (BuildDir) {
|
---|
[50f2cfc] | 119 | //Configure the conpilation (Output is not relevant)
|
---|
| 120 | //Use the current directory as the installation target so nothing escapes the sandbox
|
---|
| 121 | //Also specify the compiler by hand
|
---|
[3fc5f010] | 122 | targets=""
|
---|
[d4510ea] | 123 | if( Settings.RunAllTests || Settings.RunBenchmark ) {
|
---|
[6bde81d] | 124 | targets="--with-target-hosts='host:debug,host:nodebug'"
|
---|
[3fc5f010] | 125 | } else {
|
---|
[6bde81d] | 126 | targets="--with-target-hosts='host:debug'"
|
---|
[3fc5f010] | 127 | }
|
---|
| 128 |
|
---|
[d21dd3cb] | 129 | ast = Settings.NewAST ? "--enable-new-ast" : "--disable-new-ast"
|
---|
| 130 |
|
---|
| 131 | sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} AR=gcc-ar RANLIB=gcc-ranlib ${targets} ${ast} --quiet --prefix=${BuildDir}"
|
---|
[f253e4a] | 132 |
|
---|
| 133 | // Configure libcfa
|
---|
[e70e54e] | 134 | sh 'make -j 8 --no-print-directory configure-libcfa'
|
---|
[e507c11] | 135 | }
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | build_stage('Build : cfa-cpp', true) {
|
---|
| 139 | // Build outside of the src tree to ease cleaning
|
---|
| 140 | dir (BuildDir) {
|
---|
| 141 | // Build driver
|
---|
| 142 | sh 'make -j 8 --no-print-directory -C driver'
|
---|
| 143 |
|
---|
| 144 | // Build translator
|
---|
| 145 | sh 'make -j 8 --no-print-directory -C src'
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
[1752d0e] | 148 |
|
---|
[e507c11] | 149 | build_stage('Build : libcfa(debug)', debug) {
|
---|
| 150 | // Build outside of the src tree to ease cleaning
|
---|
| 151 | dir (BuildDir) {
|
---|
| 152 | sh "make -j 8 --no-print-directory -C libcfa/${Settings.Architecture.name}-debug"
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | build_stage('Build : libcfa(nodebug)', release) {
|
---|
| 157 | // Build outside of the src tree to ease cleaning
|
---|
| 158 | dir (BuildDir) {
|
---|
| 159 | sh "make -j 8 --no-print-directory -C libcfa/${Settings.Architecture.name}-nodebug"
|
---|
[50f2cfc] | 160 | }
|
---|
[620dd2b] | 161 | }
|
---|
[aa96fba] | 162 |
|
---|
| 163 | build_stage('Build : install', true) {
|
---|
| 164 | // Build outside of the src tree to ease cleaning
|
---|
| 165 | dir (BuildDir) {
|
---|
| 166 | sh "make -j 8 --no-print-directory install"
|
---|
| 167 | }
|
---|
| 168 | }
|
---|
[95fdb0a] | 169 | }
|
---|
[24eecab] | 170 |
|
---|
[95fdb0a] | 171 | def test() {
|
---|
[4c1b9ea8] | 172 | try {
|
---|
| 173 | build_stage('Test: short', !Settings.RunAllTests) {
|
---|
| 174 | dir (BuildDir) {
|
---|
[3e93c00] | 175 | //Run the tests from the tests directory
|
---|
[4c51aca] | 176 | sh "make --no-print-directory -C tests archiveerrors=${BuildDir}/tests/crashes/short"
|
---|
[3e93c00] | 177 | }
|
---|
[4c1b9ea8] | 178 | }
|
---|
| 179 |
|
---|
| 180 | build_stage('Test: full', Settings.RunAllTests) {
|
---|
| 181 | dir (BuildDir) {
|
---|
| 182 | //Run the tests from the tests directory
|
---|
[4c51aca] | 183 | sh """make --no-print-directory -C tests timeouts="--timeout=600 --global-timeout=14400" all-tests debug=yes archiveerrors=${BuildDir}/tests/crashes/full-debug"""
|
---|
| 184 | sh """make --no-print-directory -C tests timeouts="--timeout=600 --global-timeout=14400" all-tests debug=no archiveerrors=${BuildDir}/tests/crashes/full-nodebug"""
|
---|
[143e6f3] | 185 | }
|
---|
[9beae23] | 186 | }
|
---|
[620dd2b] | 187 | }
|
---|
[4c1b9ea8] | 188 | catch (Exception err) {
|
---|
| 189 | echo "Archiving core dumps"
|
---|
[c95fdc9] | 190 | dir (BuildDir) {
|
---|
[62f96ae] | 191 | archiveArtifacts artifacts: "tests/crashes/**/*,lib/**/lib*.so*", fingerprint: true
|
---|
[c95fdc9] | 192 | }
|
---|
[4c1b9ea8] | 193 | throw err
|
---|
| 194 | }
|
---|
[95fdb0a] | 195 | }
|
---|
| 196 |
|
---|
| 197 | def benchmark() {
|
---|
[6c55a3d] | 198 | build_stage('Benchmark', Settings.RunBenchmark) {
|
---|
[5b8413b4] | 199 | dir (BuildDir) {
|
---|
[0dc3ac3] | 200 | //Append bench results
|
---|
[c6f1f3e] | 201 | sh "make --no-print-directory -C benchmark jenkins arch=${Settings.Architecture.name}"
|
---|
[0dc3ac3] | 202 | }
|
---|
[620dd2b] | 203 | }
|
---|
[9beae23] | 204 | }
|
---|
[efd60d67] | 205 |
|
---|
[95fdb0a] | 206 | def build_doc() {
|
---|
[6c55a3d] | 207 | build_stage('Documentation', Settings.BuildDocumentation) {
|
---|
[9beae23] | 208 | dir ('doc/user') {
|
---|
| 209 | make_doc()
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | dir ('doc/refrat') {
|
---|
| 213 | make_doc()
|
---|
| 214 | }
|
---|
[620dd2b] | 215 | }
|
---|
[9beae23] | 216 | }
|
---|
| 217 |
|
---|
[95fdb0a] | 218 | def publish() {
|
---|
[6c55a3d] | 219 | build_stage('Publish', true) {
|
---|
[95fdb0a] | 220 |
|
---|
[1b3eef8] | 221 | if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' }
|
---|
[95fdb0a] | 222 |
|
---|
[3221a2b] | 223 | def groupCompile = new PlotGroup('Compilation', 'duration (s) - lower is better', true)
|
---|
| 224 | def groupConcurrency = new PlotGroup('Concurrency', 'duration (n) - lower is better', false)
|
---|
[a2a0065] | 225 |
|
---|
[3898392] | 226 | //Then publish the results
|
---|
[13d2dac] | 227 | do_plot(Settings.RunBenchmark && Settings.Publish, 'compile' , groupCompile , false, 'Compilation')
|
---|
| 228 | do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff' , groupCompile , true , 'Compilation (relative)')
|
---|
| 229 | do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch' , groupConcurrency, false, 'Context Switching')
|
---|
| 230 | do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff' , groupConcurrency, true , 'Context Switching (relative)')
|
---|
| 231 | do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex' , groupConcurrency, false, 'Mutual Exclusion')
|
---|
| 232 | do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff' , groupConcurrency, true , 'Mutual Exclusion (relative)')
|
---|
| 233 | do_plot(Settings.RunBenchmark && Settings.Publish, 'scheduling' , groupConcurrency, false, 'Internal and External Scheduling')
|
---|
| 234 | do_plot(Settings.RunBenchmark && Settings.Publish, 'scheduling.diff', groupConcurrency, true , 'Internal and External Scheduling (relative)')
|
---|
[620dd2b] | 235 | }
|
---|
[95fdb0a] | 236 | }
|
---|
| 237 |
|
---|
[29f4fe62] | 238 | //===========================================================================================================
|
---|
| 239 | //Routine responsible of sending the email notification once the build is completed
|
---|
| 240 | //===========================================================================================================
|
---|
[6b6c26e] | 241 | @NonCPS
|
---|
| 242 | def SplitLines(String text) {
|
---|
| 243 | def list = []
|
---|
| 244 |
|
---|
| 245 | text.eachLine {
|
---|
| 246 | list += it
|
---|
| 247 | }
|
---|
| 248 |
|
---|
| 249 | return list
|
---|
| 250 | }
|
---|
| 251 |
|
---|
[a336d46] | 252 | def GitLogMessage() {
|
---|
| 253 | if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n"
|
---|
[e8a22a7] | 254 |
|
---|
[fce01e7] | 255 | def oldRef = Settings.GitOldRef
|
---|
| 256 | def newRef = Settings.GitNewRef
|
---|
[6badd87] | 257 |
|
---|
[fdb6ac6] | 258 | def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim()
|
---|
[6b6c26e] | 259 | def revList = SplitLines( revText )
|
---|
[6e31c43] | 260 |
|
---|
[fdb6ac6] | 261 | def gitUpdate = ""
|
---|
| 262 | revList.each { rev ->
|
---|
[249091f] | 263 | def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
|
---|
[fce01e7] | 264 | gitUpdate = gitUpdate + " via ${rev} (${type})"
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 | def rev = oldRef
|
---|
[249091f] | 268 | def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
|
---|
| 269 | gitUpdate = gitUpdate + " from ${rev} (${type})"
|
---|
[fce01e7] | 270 |
|
---|
[249091f] | 271 | def gitLog = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim()
|
---|
[fce01e7] | 272 |
|
---|
[249091f] | 273 | def gitDiff = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim()
|
---|
[fce01e7] | 274 | gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">')
|
---|
| 275 | gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">')
|
---|
| 276 | gitDiff = gitDiff.replace('[m', '</span>')
|
---|
[7a927ed0] | 277 |
|
---|
[a336d46] | 278 | return """
|
---|
[13c98a4] | 279 | <pre>
|
---|
[848fb00] | 280 | The branch ${env.BRANCH_NAME} has been updated.
|
---|
[7a927ed0] | 281 | ${gitUpdate}
|
---|
[13c98a4] | 282 | </pre>
|
---|
| 283 |
|
---|
| 284 | <p>Check console output at ${env.BUILD_URL} to view the results.</p>
|
---|
[7b1a604] | 285 |
|
---|
[13c98a4] | 286 | <p>- Status --------------------------------------------------------------</p>
|
---|
[7b1a604] | 287 |
|
---|
[13c98a4] | 288 | <p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p>
|
---|
[7b1a604] | 289 |
|
---|
[13c98a4] | 290 | <p>- Log -----------------------------------------------------------------</p>
|
---|
[e8a22a7] | 291 |
|
---|
[13c98a4] | 292 | <pre>
|
---|
[7a927ed0] | 293 | ${gitLog}
|
---|
[13c98a4] | 294 | </pre>
|
---|
| 295 |
|
---|
| 296 | <p>-----------------------------------------------------------------------</p>
|
---|
| 297 | <pre>
|
---|
[7b1a604] | 298 | Summary of changes:
|
---|
[7a927ed0] | 299 | ${gitDiff}
|
---|
[13c98a4] | 300 | </pre>
|
---|
[7b1a604] | 301 | """
|
---|
[a336d46] | 302 | }
|
---|
| 303 |
|
---|
| 304 | //Standard build email notification
|
---|
[13c98a4] | 305 | def email(boolean log) {
|
---|
[a336d46] | 306 | //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
|
---|
| 307 | //Configurations for email format
|
---|
| 308 | echo 'Notifying users of result'
|
---|
| 309 |
|
---|
| 310 | def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
|
---|
| 311 | def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}"
|
---|
[13c98a4] | 312 | def email_body = """<p>This is an automated email from the Jenkins build machine. It was
|
---|
[a336d46] | 313 | generated because of a git hooks/post-receive script following
|
---|
[986e260] | 314 | a ref change which was pushed to the C\u2200 repository.</p>
|
---|
[a336d46] | 315 | """ + GitLogMessage()
|
---|
[e8a22a7] | 316 |
|
---|
[13c98a4] | 317 | def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
|
---|
[e8a22a7] | 318 |
|
---|
[13c98a4] | 319 | if( Settings && !Settings.Silent ) {
|
---|
[094a42c] | 320 | //send email notification
|
---|
| 321 | emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
|
---|
| 322 | } else {
|
---|
| 323 | echo "Would send email to: ${email_to}"
|
---|
| 324 | echo "With title: ${email_subject}"
|
---|
| 325 | echo "Content: \n${email_body}"
|
---|
| 326 | }
|
---|
[e8a22a7] | 327 | }
|
---|
[5b8413b4] | 328 |
|
---|
| 329 | //===========================================================================================================
|
---|
| 330 | // Helper classes/variables/routines
|
---|
| 331 | //===========================================================================================================
|
---|
| 332 | //Description of a compiler (Must be serializable since pipelines are persistent)
|
---|
| 333 | class CC_Desc implements Serializable {
|
---|
[93fe3154] | 334 | public String name
|
---|
| 335 | public String CXX
|
---|
[6ebc13f] | 336 | public String CC
|
---|
[bf22bc6] | 337 | public String lto
|
---|
[93fe3154] | 338 |
|
---|
[bf22bc6] | 339 | CC_Desc(String name, String CXX, String CC, String lto) {
|
---|
[93fe3154] | 340 | this.name = name
|
---|
| 341 | this.CXX = CXX
|
---|
[bf22bc6] | 342 | this.CC = CC
|
---|
| 343 | this.lto = lto
|
---|
[5b8413b4] | 344 | }
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | //Description of an architecture (Must be serializable since pipelines are persistent)
|
---|
| 348 | class Arch_Desc implements Serializable {
|
---|
| 349 | public String name
|
---|
| 350 | public String flags
|
---|
[5307c33] | 351 | public String node
|
---|
[5b8413b4] | 352 |
|
---|
[5307c33] | 353 | Arch_Desc(String name, String flags, String node) {
|
---|
[5b8413b4] | 354 | this.name = name
|
---|
| 355 | this.flags = flags
|
---|
[5307c33] | 356 | this.node = node
|
---|
[5b8413b4] | 357 | }
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | class BuildSettings implements Serializable {
|
---|
| 361 | public final CC_Desc Compiler
|
---|
| 362 | public final Arch_Desc Architecture
|
---|
[d21dd3cb] | 363 | public final Boolean NewAST
|
---|
[5b8413b4] | 364 | public final Boolean RunAllTests
|
---|
| 365 | public final Boolean RunBenchmark
|
---|
| 366 | public final Boolean BuildDocumentation
|
---|
| 367 | public final Boolean Publish
|
---|
| 368 | public final Boolean Silent
|
---|
| 369 | public final Boolean IsSandbox
|
---|
| 370 | public final String DescLong
|
---|
| 371 | public final String DescShort
|
---|
| 372 |
|
---|
[a336d46] | 373 | public String GitNewRef
|
---|
| 374 | public String GitOldRef
|
---|
| 375 |
|
---|
[490cb3c] | 376 | BuildSettings(java.util.Collections$UnmodifiableMap param, String branch) {
|
---|
[5b8413b4] | 377 | switch( param.Compiler ) {
|
---|
[099f5bd] | 378 | case 'gcc-9':
|
---|
[bf22bc6] | 379 | this.Compiler = new CC_Desc('gcc-9', 'g++-9', 'gcc-9', '-flto=auto')
|
---|
[099f5bd] | 380 | break
|
---|
| 381 | case 'gcc-8':
|
---|
[bf22bc6] | 382 | this.Compiler = new CC_Desc('gcc-8', 'g++-8', 'gcc-8', '-flto=auto')
|
---|
[099f5bd] | 383 | break
|
---|
| 384 | case 'gcc-7':
|
---|
[bf22bc6] | 385 | this.Compiler = new CC_Desc('gcc-7', 'g++-7', 'gcc-7', '-flto=auto')
|
---|
[099f5bd] | 386 | break
|
---|
[5b8413b4] | 387 | case 'gcc-6':
|
---|
[bf22bc6] | 388 | this.Compiler = new CC_Desc('gcc-6', 'g++-6', 'gcc-6', '-flto=auto')
|
---|
[5b8413b4] | 389 | break
|
---|
| 390 | case 'gcc-5':
|
---|
[bf22bc6] | 391 | this.Compiler = new CC_Desc('gcc-5', 'g++-5', 'gcc-5', '-flto=auto')
|
---|
[5b8413b4] | 392 | break
|
---|
| 393 | case 'gcc-4.9':
|
---|
[bf22bc6] | 394 | this.Compiler = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9', '-flto=auto')
|
---|
[5b8413b4] | 395 | break
|
---|
| 396 | case 'clang':
|
---|
[391c065] | 397 | this.Compiler = new CC_Desc('clang', 'clang++-10', 'gcc-9', '-flto=thin -flto-jobs=0')
|
---|
[5b8413b4] | 398 | break
|
---|
| 399 | default :
|
---|
| 400 | error "Unhandled compiler : ${cc}"
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 | switch( param.Architecture ) {
|
---|
| 404 | case 'x64':
|
---|
[a3e8281] | 405 | this.Architecture = new Arch_Desc('x64', '--host=x86_64', 'x64')
|
---|
[5b8413b4] | 406 | break
|
---|
| 407 | case 'x86':
|
---|
[a3e8281] | 408 | this.Architecture = new Arch_Desc('x86', '--host=i386', 'x86')
|
---|
[5b8413b4] | 409 | break
|
---|
| 410 | default :
|
---|
| 411 | error "Unhandled architecture : ${arch}"
|
---|
| 412 | }
|
---|
| 413 |
|
---|
[f95e8f0] | 414 | this.IsSandbox = (branch == "jenkins-sandbox")
|
---|
[d21dd3cb] | 415 | this.NewAST = param.NewAST
|
---|
[5b8413b4] | 416 | this.RunAllTests = param.RunAllTests
|
---|
[7a230fd] | 417 | this.RunBenchmark = param.RunBenchmark
|
---|
[5b8413b4] | 418 | this.BuildDocumentation = param.BuildDocumentation
|
---|
[7a230fd] | 419 | this.Publish = param.Publish
|
---|
[5b8413b4] | 420 | this.Silent = param.Silent
|
---|
| 421 |
|
---|
| 422 | def full = param.RunAllTests ? " (Full)" : ""
|
---|
[490cb3c] | 423 | this.DescShort = "${ this.Compiler.name }:${ this.Architecture.name }${full}"
|
---|
[5b8413b4] | 424 |
|
---|
[93fe3154] | 425 | this.DescLong = """Compiler : ${ this.Compiler.name } (${ this.Compiler.CXX }/${ this.Compiler.CC })
|
---|
[5b8413b4] | 426 | Architecture : ${ this.Architecture.name }
|
---|
| 427 | Arc Flags : ${ this.Architecture.flags }
|
---|
| 428 | Run All Tests : ${ this.RunAllTests.toString() }
|
---|
| 429 | Run Benchmark : ${ this.RunBenchmark.toString() }
|
---|
| 430 | Build Documentation : ${ this.BuildDocumentation.toString() }
|
---|
| 431 | Publish : ${ this.Publish.toString() }
|
---|
| 432 | Silent : ${ this.Silent.toString() }
|
---|
| 433 | """
|
---|
[a336d46] | 434 |
|
---|
| 435 | this.GitNewRef = ''
|
---|
| 436 | this.GitOldRef = ''
|
---|
[5b8413b4] | 437 | }
|
---|
| 438 | }
|
---|
| 439 |
|
---|
[490cb3c] | 440 | class PlotGroup implements Serializable {
|
---|
| 441 | public String name
|
---|
| 442 | public String unit
|
---|
| 443 | public boolean log
|
---|
| 444 |
|
---|
| 445 | PlotGroup(String name, String unit, boolean log) {
|
---|
| 446 | this.name = name
|
---|
| 447 | this.unit = unit
|
---|
| 448 | this.log = log
|
---|
| 449 | }
|
---|
| 450 | }
|
---|
| 451 |
|
---|
[5b8413b4] | 452 | def prepare_build() {
|
---|
| 453 | // prepare the properties
|
---|
| 454 | properties ([ \
|
---|
[62f96ae] | 455 | buildDiscarder(logRotator( \
|
---|
| 456 | artifactDaysToKeepStr: '', \
|
---|
| 457 | artifactNumToKeepStr: '', \
|
---|
| 458 | daysToKeepStr: '730', \
|
---|
| 459 | numToKeepStr: '1000' \
|
---|
| 460 | )), \
|
---|
[5b8413b4] | 461 | [$class: 'ParametersDefinitionProperty', \
|
---|
| 462 | parameterDefinitions: [ \
|
---|
| 463 | [$class: 'ChoiceParameterDefinition', \
|
---|
| 464 | description: 'Which compiler to use', \
|
---|
| 465 | name: 'Compiler', \
|
---|
[c09ae73] | 466 | choices: 'gcc-9\ngcc-8\ngcc-7\ngcc-6\ngcc-5\ngcc-4.9\nclang', \
|
---|
[fe27d99] | 467 | defaultValue: 'gcc-8', \
|
---|
[5b8413b4] | 468 | ], \
|
---|
| 469 | [$class: 'ChoiceParameterDefinition', \
|
---|
| 470 | description: 'The target architecture', \
|
---|
| 471 | name: 'Architecture', \
|
---|
| 472 | choices: 'x64\nx86', \
|
---|
| 473 | defaultValue: 'x64', \
|
---|
| 474 | ], \
|
---|
[d21dd3cb] | 475 | [$class: 'BooleanParameterDefinition', \
|
---|
| 476 | description: 'If true, build compiler using new AST', \
|
---|
| 477 | name: 'NewAST', \
|
---|
| 478 | defaultValue: false, \
|
---|
| 479 | ], \
|
---|
[5b8413b4] | 480 | [$class: 'BooleanParameterDefinition', \
|
---|
| 481 | description: 'If false, only the quick test suite is ran', \
|
---|
| 482 | name: 'RunAllTests', \
|
---|
| 483 | defaultValue: false, \
|
---|
[d21dd3cb] | 484 | ],
|
---|
[5b8413b4] | 485 | [$class: 'BooleanParameterDefinition', \
|
---|
| 486 | description: 'If true, jenkins also runs benchmarks', \
|
---|
| 487 | name: 'RunBenchmark', \
|
---|
| 488 | defaultValue: false, \
|
---|
| 489 | ], \
|
---|
| 490 | [$class: 'BooleanParameterDefinition', \
|
---|
| 491 | description: 'If true, jenkins also builds documentation', \
|
---|
| 492 | name: 'BuildDocumentation', \
|
---|
| 493 | defaultValue: true, \
|
---|
| 494 | ], \
|
---|
| 495 | [$class: 'BooleanParameterDefinition', \
|
---|
| 496 | description: 'If true, jenkins also publishes results', \
|
---|
| 497 | name: 'Publish', \
|
---|
| 498 | defaultValue: false, \
|
---|
| 499 | ], \
|
---|
| 500 | [$class: 'BooleanParameterDefinition', \
|
---|
| 501 | description: 'If true, jenkins will not send emails', \
|
---|
| 502 | name: 'Silent', \
|
---|
| 503 | defaultValue: false, \
|
---|
| 504 | ], \
|
---|
| 505 | ],
|
---|
| 506 | ]])
|
---|
| 507 |
|
---|
[4c55047] | 508 | // It's unfortunate but it looks like we need to checkout the entire repo just to get the pretty git printer
|
---|
| 509 | checkout scm
|
---|
[2407853] | 510 |
|
---|
[490cb3c] | 511 | final settings = new BuildSettings(params, env.BRANCH_NAME)
|
---|
[5b8413b4] | 512 |
|
---|
| 513 | currentBuild.description = settings.DescShort
|
---|
| 514 | echo settings.DescLong
|
---|
| 515 |
|
---|
| 516 | return settings
|
---|
| 517 | }
|
---|
| 518 |
|
---|
[6c55a3d] | 519 | def build_stage(String name, boolean run, Closure block ) {
|
---|
[5b8413b4] | 520 | StageName = name
|
---|
| 521 | echo " -------- ${StageName} -------- "
|
---|
[8ecb590] | 522 | if(run) {
|
---|
| 523 | stage(name, block)
|
---|
| 524 | } else {
|
---|
| 525 | stage(name) { Utils.markStageSkippedForConditional(STAGE_NAME) }
|
---|
| 526 | }
|
---|
[5b8413b4] | 527 | }
|
---|
| 528 |
|
---|
| 529 | def make_doc() {
|
---|
| 530 | def err = null
|
---|
| 531 | try {
|
---|
| 532 | sh 'make clean > /dev/null'
|
---|
| 533 | sh 'make > /dev/null 2>&1'
|
---|
| 534 | }
|
---|
| 535 | catch (Exception caughtError) {
|
---|
| 536 | err = caughtError //rethrow error later
|
---|
[65f4a51] | 537 | sh 'cat build/*.log'
|
---|
[5b8413b4] | 538 | }
|
---|
| 539 | finally {
|
---|
| 540 | if (err) throw err // Must re-throw exception to propagate error
|
---|
| 541 | }
|
---|
[a2a0065] | 542 | }
|
---|
| 543 |
|
---|
[3221a2b] | 544 | def do_plot(boolean new_data, String file, PlotGroup group, boolean relative, String title) {
|
---|
[8d63649] | 545 |
|
---|
[1b3eef8] | 546 | if(new_data) {
|
---|
| 547 | echo "Publishing new data"
|
---|
| 548 | }
|
---|
| 549 |
|
---|
[cdcd53dc] | 550 | def series = new_data ? [[
|
---|
[df57a84] | 551 | file: "${file}.csv",
|
---|
[3c40dc2a] | 552 | exclusionValues: '',
|
---|
| 553 | displayTableFlag: false,
|
---|
| 554 | inclusionFlag: 'OFF',
|
---|
| 555 | url: ''
|
---|
[cdcd53dc] | 556 | ]] : [];
|
---|
[8d63649] | 557 |
|
---|
| 558 | echo "file is ${BuildDir}/benchmark/${file}.csv, group ${group}, title ${title}"
|
---|
| 559 | dir("${BuildDir}/benchmark/") {
|
---|
| 560 | plot csvFileName: "cforall-${env.BRANCH_NAME}-${file}.csv",
|
---|
| 561 | csvSeries: series,
|
---|
[490cb3c] | 562 | group: "${group.name}",
|
---|
[3c40dc2a] | 563 | title: "${title}",
|
---|
| 564 | style: 'lineSimple',
|
---|
| 565 | exclZero: false,
|
---|
| 566 | keepRecords: false,
|
---|
[3221a2b] | 567 | logarithmic: !relative && group.log,
|
---|
[3c40dc2a] | 568 | numBuilds: '120',
|
---|
| 569 | useDescr: true,
|
---|
[490cb3c] | 570 | yaxis: group.unit,
|
---|
[3c40dc2a] | 571 | yaxisMaximum: '',
|
---|
| 572 | yaxisMinimum: ''
|
---|
[df57a84] | 573 | }
|
---|
| 574 | }
|
---|