update script for nightly build

This commit is contained in:
Roman Volosovskyi 2017-11-11 08:05:03 +01:00
parent 0d4cbd98e5
commit 900d4074bf
1 changed files with 12 additions and 8 deletions

View File

@ -4,21 +4,23 @@
env.LANG="en_US.UTF-8" env.LANG="en_US.UTF-8"
env.LANGUAGE="en_US.UTF-8" env.LANGUAGE="en_US.UTF-8"
env.LC_ALL="en_US.UTF-8" env.LC_ALL="en_US.UTF-8"
node {
node ('macos1'){
def apkUrl = '' def apkUrl = ''
def ipaUrl = '' def ipaUrl = ''
def testPassed = true def testPassed = true
sh 'source /etc/profile' load "$HOME/env.groovy"
try { try {
stage('Git & Dependencies') { stage('Git & Dependencies') {
slackSend color: 'good', message: 'Nightly build started. ' + env.BUILD_URL
git([url: 'https://github.com/status-im/status-react.git', branch: 'develop']) git([url: 'https://github.com/status-im/status-react.git', branch: 'develop'])
// Checkout master because used for iOS Plist version information // Checkout master because used for iOS Plist version information
sh 'git checkout -- .' sh 'git checkout -- .'
sh 'git fetch --tags' sh 'git fetch --tags'
sh 'git checkout master' sh 'git checkout master'
sh 'git checkout ' + 'develop' sh 'git checkout ' + 'develop'
sh 'rm -rf node_modules' sh 'rm -rf node_modules'
sh 'cp .env.jenkins .env' sh 'cp .env.jenkins .env'
@ -42,17 +44,19 @@ node {
stage('Build (iOS)') { stage('Build (iOS)') {
sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive' sh 'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration release -archivePath status clean archive'
sh 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist /Users/Xcloud/archive.plist' sh 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist ~/archive.plist'
} }
stage('Deploy (Android)') { stage('Deploy (Android)') {
def artifact_dir = pwd() + '/android/app/build/outputs/apk/' def artifact_dir = pwd() + '/android/app/build/outputs/apk/'
def artifact = new File(artifact_dir + 'app-release.apk') println (artifact_dir + 'app-release.apk')
assert artifact.exists() sh ('ls -la ' + artifact_dir)
def artifact = (artifact_dir + 'app-release.apk')
def server = Artifactory.server('artifacts') def server = Artifactory.server('artifacts')
def shortCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(6) def shortCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(6)
def filename = 'im.status.ethereum-' + shortCommit + '.apk' def filename = 'im.status.ethereum-' + shortCommit + '.apk'
artifact.renameTo artifact_dir + filename def newArtifact = (artifact_dir + filename)
sh ('mv ' + artifact + ' ' + newArtifact)
def uploadSpec = '{ "files": [ { "pattern": "*apk/' + filename + '", "target": "nightlies-local" }]}' def uploadSpec = '{ "files": [ { "pattern": "*apk/' + filename + '", "target": "nightlies-local" }]}'
def buildInfo = server.upload(uploadSpec) def buildInfo = server.upload(uploadSpec)
apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename
@ -75,4 +79,4 @@ node {
def c = (testPassed ? 'good' : 'warning' ) def c = (testPassed ? 'good' : 'warning' )
slackSend color: c, message: 'Nightly build (develop) \nTests: ' + (testPassed ? ':+1:' : ':-1:') + ')\nAndroid: ' + apkUrl + '\n iOS: ' + ipaUrl slackSend color: c, message: 'Nightly build (develop) \nTests: ' + (testPassed ? ':+1:' : ':-1:') + ')\nAndroid: ' + apkUrl + '\n iOS: ' + ipaUrl
} }
} }