Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 2 | |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 3 | stage 'Starting CI check' |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 4 | node { |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 5 | } |
| 6 | |
| 7 | ////////////////////// |
| 8 | |
| 9 | stage 'Parallel builds' |
| 10 | |
| 11 | def labels = [ |
| 12 | "OSX-10.12", |
| 13 | "Ubuntu-16.04-64bit", |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 14 | "code-coverage", |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 15 | ] |
| 16 | |
| 17 | def builds = [:] |
| 18 | |
| 19 | // Apparently, cannot use for-loop iteration, see https://issues.jenkins-ci.org/browse/JENKINS-27421 |
| 20 | for (int i = 0; i < labels.size(); i++) { |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 21 | String label = labels.get(i); |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 22 | |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 23 | builds[label] = { |
| 24 | node(label) { |
| 25 | wrap([$class: 'hudson.plugins.ansicolor.AnsiColorBuildWrapper', colorMapName: 'xterm']) { |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 26 | |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 27 | deleteDir() |
| 28 | git url: 'https://gerrit.named-data.net/ChronoShare' |
| 29 | sh "git fetch origin ${GERRIT_REFSPEC} && git checkout FETCH_HEAD" |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 30 | |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 31 | withEnv(["NODE_LABELS=\"$label\""]) { |
| 32 | sh "./.jenkins" |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 33 | } |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 34 | |
| 35 | if (label == "code-coverage") { |
| 36 | publishHTML(target: [ |
| 37 | allowMissing: false, |
| 38 | alwaysLinkToLastBuild: false, |
| 39 | keepAll: true, |
| 40 | reportDir: 'build/coverage', |
| 41 | reportFiles: 'index.html', |
| 42 | reportName: "GCOVR Coverage Report" |
| 43 | ]) |
| 44 | // CoverturaPublisher is not yet supported by pipelines, see https://issues.jenkins-ci.org/browse/JENKINS-30700 |
| 45 | // step([$class: 'CoberturaPublisher', |
| 46 | // coberturaReportFile: 'build/coverage.xml', |
| 47 | // autoUpdateHealth: false, autoUpdateStability: false, zoomCoverageChart: true, |
| 48 | // failNoReports: true, failUnhealthy: false, failUnstable: false, |
| 49 | // maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'UTF-8']) |
| 50 | } else { |
| 51 | // don't publish test results for code coverage run |
| 52 | step([$class: 'XUnitBuilder', |
| 53 | testTimeMargin: '50000', thresholdMode: 1, |
| 54 | tools: [[$class: 'BoostTestJunitHudsonTestType', deleteOutputFiles: true, failIfNotNew: true, |
| 55 | pattern: 'build/xunit*.xml', skipNoTestFiles: true, stopProcessingIfError: true]]]) |
| 56 | } |
| 57 | } |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 58 | } |
Lijing Wang | e84adea | 2015-05-31 16:25:16 -0700 | [diff] [blame] | 59 | } |
Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | parallel builds |