|
| 1 | +pipeline |
| 2 | +{ |
| 3 | + agent { label 'Zap-Build' } |
| 4 | + |
| 5 | + options { buildDiscarder(logRotator(artifactNumToKeepStr: '10')) } |
| 6 | + |
| 7 | + stages |
| 8 | + { |
| 9 | + stage('Git setup') |
| 10 | + { |
| 11 | + steps |
| 12 | + { |
| 13 | + script |
| 14 | + { |
| 15 | + checkout scm |
| 16 | + sh 'git submodule update --init --recursive' |
| 17 | + } |
| 18 | + } |
| 19 | + } |
| 20 | + stage('Npm install') |
| 21 | + { |
| 22 | + steps |
| 23 | + { |
| 24 | + script |
| 25 | + { |
| 26 | + sh 'npm install' |
| 27 | + sh 'npm list || true' |
| 28 | + } |
| 29 | + } |
| 30 | + } |
| 31 | + stage('License check') |
| 32 | + { |
| 33 | + steps |
| 34 | + { |
| 35 | + script |
| 36 | + { |
| 37 | + sh 'npm run lic' |
| 38 | + } |
| 39 | + } |
| 40 | + } |
| 41 | + stage('Build SPA layout for unit tests') |
| 42 | + { |
| 43 | + steps |
| 44 | + { |
| 45 | + script |
| 46 | + { |
| 47 | + sh 'npm run build-spa' |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + stage('Unit test execution') |
| 52 | + { |
| 53 | + steps |
| 54 | + { |
| 55 | + script |
| 56 | + { |
| 57 | + sh 'npm run test' |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + stage('Zap application build') |
| 62 | + { |
| 63 | + steps |
| 64 | + { |
| 65 | + script |
| 66 | + { |
| 67 | + sh 'npm run electron-build' |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + stage('Generate HTML documentation') |
| 72 | + { |
| 73 | + steps |
| 74 | + { |
| 75 | + script |
| 76 | + { |
| 77 | + sh 'npm run doc' |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | + stage('Artifact creation') |
| 82 | + { |
| 83 | + steps |
| 84 | + { |
| 85 | + script |
| 86 | + { |
| 87 | + zip archive: true, dir: './dist/electron/zap-linux-x64', glob: '', zipFile: 'zap-linux-x64.zip' |
| 88 | + zip archive: true, dir: './dist/electron/zap-linux-ia32', glob: '', zipFile: 'zap-linux-ia32.zip' |
| 89 | + zip archive: true, dir: './dist/electron/zap-darwin-x64', glob: '', zipFile: 'zap-darwin-x64.zip' |
| 90 | + zip archive: true, dir: './dist/electron/zap-win32-ia32', glob: '', zipFile: 'zap-win32-ia32.zip' |
| 91 | + zip archive: true, dir: './dist/electron/zap-win32-x64', glob: '', zipFile: 'zap-win32-x64.zip' |
| 92 | + archiveArtifacts artifacts:'generated-html/**', fingerprint: true |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | + stage('Build status resolution') |
| 97 | + { |
| 98 | + steps |
| 99 | + { |
| 100 | + script |
| 101 | + { |
| 102 | + currentBuild.result = "SUCCESS" |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + post { |
| 108 | + always { |
| 109 | + script |
| 110 | + { |
| 111 | + def committers = emailextrecipients([[$class: 'CulpritsRecipientProvider'], |
| 112 | + [$class: 'DevelopersRecipientProvider']]) |
| 113 | + |
| 114 | + jobName = "${currentBuild.fullDisplayName}".replace("%2","/") |
| 115 | + if(currentBuild.result != "SUCCESS") |
| 116 | + { |
| 117 | + slackMessage=":zap_failure: FAILED: <${env.RUN_DISPLAY_URL}|"+jobName + ">, changes by: " + committers |
| 118 | + slackColor='#FF0000' |
| 119 | + slackSend (color: slackColor, channel: '#zap', message: slackMessage) |
| 120 | + } |
| 121 | + else |
| 122 | + { |
| 123 | + slackMessage=":zap_success: SUCCESS: <${env.RUN_DISPLAY_URL}|"+jobName + ">, changes by: " + committers |
| 124 | + slackColor='good' |
| 125 | + slackSend (color: slackColor, channel: '#zap', message: slackMessage) |
| 126 | + } |
| 127 | + } |
| 128 | + cleanWs() |
| 129 | + } |
| 130 | + } |
| 131 | +} |
0 commit comments