2017-11-30 20:29:27 +00:00
|
|
|
env.LANG="en_US.UTF-8"
|
|
|
|
env.LANGUAGE="en_US.UTF-8"
|
|
|
|
env.LC_ALL="en_US.UTF-8"
|
2018-01-03 11:21:54 +00:00
|
|
|
|
|
|
|
def installJSDeps() {
|
|
|
|
def attempt = 1
|
|
|
|
def maxAttempts = 10
|
|
|
|
def installed = false
|
|
|
|
while (!installed && attempt <= maxAttempts) {
|
|
|
|
println "#${attempt} attempt to install npm deps"
|
|
|
|
sh 'npm install'
|
|
|
|
installed = fileExists('node_modules/web3/index.js')
|
2018-01-16 23:52:15 +00:00
|
|
|
attemp = attempt + 1
|
2018-01-03 11:21:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-30 20:29:27 +00:00
|
|
|
node ('macos1') {
|
|
|
|
def apkUrl = ''
|
|
|
|
def ipaUrl = ''
|
|
|
|
def testPassed = true
|
|
|
|
def branch;
|
|
|
|
|
|
|
|
load "$HOME/env.groovy"
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
stage('Git & Dependencies') {
|
|
|
|
slackSend color: 'good', message: REPO + ":" + BRANCH_NAME + ' build started. ' + env.BUILD_URL
|
2018-02-28 07:38:38 +00:00
|
|
|
|
|
|
|
checkout scm
|
|
|
|
|
2017-11-30 20:29:27 +00:00
|
|
|
sh 'rm -rf node_modules'
|
|
|
|
|
2018-01-04 14:01:01 +00:00
|
|
|
sh 'test ${JENKINS_REBASE_DEVELOP} -eq 1 && git rebase origin/develop || echo "Not rebasing on develop."'
|
2018-01-03 16:49:18 +00:00
|
|
|
|
2017-11-30 20:29:27 +00:00
|
|
|
// Assume all parameters are set in Jenkins 'Parameterized build'
|
|
|
|
// TODO(oskarth): Consider read/write from .env to avoid having to specify in Jenkins again
|
|
|
|
// sh 'cp .env.jenkins .env'
|
2018-03-13 08:05:58 +00:00
|
|
|
sh 'echo TESTFAIRY_ENABLED=' + TESTFAIRY_ENABLED + '>>' + '.env'
|
|
|
|
sh 'echo STUB_STATUS_GO=' + STUB_STATUS_GO + '>>' + '.env'
|
|
|
|
sh 'echo ETHEREUM_DEV_CLUSTER=' + ETHEREUM_DEV_CLUSTER + '>>' + '.env'
|
|
|
|
sh 'echo MAINNET_NETWORKS_ENABLED=' + MAINNET_NETWORKS_ENABLED + '>>' + '.env'
|
|
|
|
sh 'echo LOG_LEVEL=' + LOG_LEVEL + '>>' + '.env'
|
|
|
|
sh 'echo LOG_LEVEL_STATUS_GO=' + LOG_LEVEL_STATUS_GO + '>>' + '.env'
|
|
|
|
sh 'echo OFFLINE_INBOX_ENABLED=' + OFFLINE_INBOX_ENABLED + '>>' + '.env'
|
|
|
|
sh 'echo MANY_WHISPER_TOPICS_ENABLED=' + MANY_WHISPER_TOPICS_ENABLED + '>>' + '.env'
|
|
|
|
sh 'echo POW_TARGET=' + POW_TARGET + '>>' + '.env'
|
|
|
|
sh 'echo POW_TIME=' + POW_TIME + '>>' + '.env'
|
2017-11-30 20:29:27 +00:00
|
|
|
|
|
|
|
sh 'echo "**********************************************************************"'
|
|
|
|
sh 'echo PARAMETERIZED BUILD - USING CUSTOM ENVIRONMENT'
|
|
|
|
sh 'cat .env'
|
|
|
|
sh 'echo "**********************************************************************"'
|
|
|
|
|
2018-01-03 11:21:54 +00:00
|
|
|
sh 'lein deps'
|
|
|
|
installJSDeps()
|
2017-12-16 22:29:59 +00:00
|
|
|
|
2017-11-30 20:29:27 +00:00
|
|
|
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
|
|
|
|
sh 'cd ios && pod install && cd ..'
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Tests') {
|
|
|
|
sh 'lein test-cljs'
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Build') {
|
|
|
|
sh 'lein prod-build'
|
|
|
|
}
|
|
|
|
|
|
|
|
// Android
|
|
|
|
stage('Build (Android)') {
|
|
|
|
sh 'cd android && ./gradlew assembleRelease'
|
|
|
|
}
|
|
|
|
stage('Deploy (Android)') {
|
|
|
|
withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
|
2018-01-13 12:11:37 +00:00
|
|
|
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@android/app/build/outputs/apk/release/app-release.apk -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
|
2017-11-30 20:29:27 +00:00
|
|
|
sh 'sleep 10'
|
|
|
|
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
|
|
|
apkUrl = 'https://i.diawi.com/' + hash
|
|
|
|
|
|
|
|
sh ('echo ARTIFACT Android: ' + apkUrl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// try {
|
|
|
|
// stage('Test (Android)') {
|
|
|
|
// sauce('b9aded57-5cc1-4f6b-b5ea-42d989987852') {
|
|
|
|
// sh 'cd test/appium && mvn -DapkUrl=' + apkUrl + ' test'
|
|
|
|
// saucePublisher()
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } catch(e) {
|
|
|
|
// testPassed = false
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 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 'xcodebuild -exportArchive -exportPath status -archivePath status.xcarchive -exportOptionsPlist ~/archive.plist'
|
|
|
|
}
|
|
|
|
stage('Deploy (iOS)') {
|
|
|
|
withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
|
|
|
|
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
|
|
|
|
sh 'sleep 10'
|
|
|
|
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
|
|
|
|
ipaUrl = 'https://i.diawi.com/' + hash
|
|
|
|
|
|
|
|
sh ('echo ARTIFACT iOS: ' + ipaUrl)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Slack Notification') {
|
|
|
|
def c = (testPassed ? 'good' : 'warning' )
|
|
|
|
slackSend color: c, message: 'Branch: ' + REPO + ":" + BRANCH_NAME +
|
|
|
|
'\nAndroid: ' + apkUrl +
|
|
|
|
'\niOS: ' + ipaUrl
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
slackSend color: 'bad', message: REPO + ":" + BRANCH_NAME + ' failed to build. ' + env.BUILD_URL
|
|
|
|
throw e
|
|
|
|
}
|
2017-12-11 14:08:10 +00:00
|
|
|
}
|