use nvm() wrapper in jenkins for android builds

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-01-15 15:44:50 +01:00
parent 420a64e72d
commit 243a2d1885
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
6 changed files with 55 additions and 30 deletions

View File

@ -44,32 +44,36 @@ pipeline {
mobile = load 'ci/mobile.groovy' mobile = load 'ci/mobile.groovy'
cmn = load 'ci/common.groovy' cmn = load 'ci/common.groovy'
print "Running ${cmn.getBuildType()} build!" print "Running ${cmn.getBuildType()} build!"
/* Cleanup and Prep */
mobile.prep(cmn.getBuildType())
/* Run at start to void mismatched numbers */ /* Run at start to void mismatched numbers */
cmn.buildNumber() cmn.buildNumber()
/* Read the valid NodeJS version */
env.NODE_VERSION = cmn.getToolVersion('node')
/* Cleanup and Prep */
nvm(env.NODE_VERSION) {
mobile.prep(cmn.getBuildType())
}
} }
} }
} }
stage('Lint') { stage('Lint') {
steps { steps { nvm(env.NODE_VERSION) {
script { cmn.runLint() } script { cmn.runLint() }
} } }
} }
stage('Tests') { stage('Tests') {
steps { steps { nvm(env.NODE_VERSION) {
script { cmn.runTests() } script { cmn.runTests() }
} } }
} }
stage('Build') { stage('Build') {
steps { steps { nvm(env.NODE_VERSION) {
script { mobile.leinBuild('android') } script { mobile.leinBuild('android') }
} } }
} }
stage('Bundle') { stage('Bundle') {
steps { steps { nvm(env.NODE_VERSION) {
script { apk = mobile.android.bundle(cmn.getBuildType()) } script { apk = mobile.android.bundle(cmn.getBuildType()) }
} } }
} }
stage('Archive') { stage('Archive') {
steps { steps {

View File

@ -23,7 +23,6 @@ pipeline {
} }
environment { environment {
NODE_VERSION = 'v10.14.1'
BUILD_PLATFORM = 'ios' BUILD_PLATFORM = 'ios'
LANG = 'en_US.UTF-8' LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8'
@ -36,16 +35,20 @@ pipeline {
stages { stages {
stage('Prep') { stage('Prep') {
steps { steps {
script { nvm(env.NODE_VERSION) { script {
/* Necessary to load methods */ /* Necessary to load methods */
mobile = load 'ci/mobile.groovy' mobile = load 'ci/mobile.groovy'
cmn = load 'ci/common.groovy' cmn = load 'ci/common.groovy'
print "Running ${cmn.getBuildType()} build!" print "Running ${cmn.getBuildType()} build!"
/* Cleanup and Prep */
mobile.prep(cmn.getBuildType())
/* Run at start to void mismatched numbers */ /* Run at start to void mismatched numbers */
cmn.buildNumber() cmn.buildNumber()
} } /* Read the valid NodeJS version */
env.NODE_VERSION = cmn.getToolVersion('node')
/* Cleanup and Prep */
nvm(env.NODE_VERSION) {
mobile.prep(cmn.getBuildType())
}
}
} }
} }
stage('Lint') { stage('Lint') {

View File

@ -40,7 +40,6 @@ pipeline {
* https://issues.jenkins-ci.org/browse/JENKINS-49076 * https://issues.jenkins-ci.org/browse/JENKINS-49076
**/ **/
environment { environment {
NODE_VERSION = 'v10.14.1'
BUILD_PLATFORM = 'linux' BUILD_PLATFORM = 'linux'
LANG = 'en_US.UTF-8' LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8'
@ -55,13 +54,17 @@ pipeline {
stages { stages {
stage('Prep') { stage('Prep') {
steps { steps {
script { nvm(env.NODE_VERSION) { script {
/* Necessary to load methods */ /* Necessary to load methods */
desktop = load 'ci/desktop.groovy' desktop = load 'ci/desktop.groovy'
cmn = load 'ci/common.groovy' cmn = load 'ci/common.groovy'
sh 'env' /* Read the valid NodeJS version */
env.NODE_VERSION = cmn.getToolVersion('node')
/* Cleanup and Prep */
nvm(env.NODE_VERSION) {
desktop.prepDeps() desktop.prepDeps()
} } }
}
} }
} }
stage('Lint') { stage('Lint') {

View File

@ -23,7 +23,6 @@ pipeline {
} }
environment { environment {
NODE_VERSION = 'v10.14.1'
BUILD_PLATFORM = 'macos' BUILD_PLATFORM = 'macos'
LANG = 'en_US.UTF-8' LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8'
@ -37,12 +36,17 @@ pipeline {
stages { stages {
stage('Prep') { stage('Prep') {
steps { steps {
script { nvm(env.NODE_VERSION) { script {
/* Necessary to load methods */ /* Necessary to load methods */
desktop = load 'ci/desktop.groovy' desktop = load 'ci/desktop.groovy'
cmn = load 'ci/common.groovy' cmn = load 'ci/common.groovy'
/* Read the valid NodeJS version */
env.NODE_VERSION = cmn.getToolVersion('node')
/* Cleanup and Prep */
nvm(env.NODE_VERSION) {
desktop.prepDeps() desktop.prepDeps()
} } }
}
} }
} }
stage('Lint') { stage('Lint') {

View File

@ -40,7 +40,6 @@ pipeline {
* https://issues.jenkins-ci.org/browse/JENKINS-49076 * https://issues.jenkins-ci.org/browse/JENKINS-49076
**/ **/
environment { environment {
NODE_VERSION = 'v10.14.1'
BUILD_PLATFORM = 'windows' BUILD_PLATFORM = 'windows'
LANG = 'en_US.UTF-8' LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8'
@ -58,13 +57,17 @@ pipeline {
stages { stages {
stage('Prep') { stage('Prep') {
steps { steps {
script { nvm(env.NODE_VERSION) { script {
/* Necessary to load methods */ /* Necessary to load methods */
desktop = load 'ci/desktop.groovy' desktop = load 'ci/desktop.groovy'
cmn = load 'ci/common.groovy' cmn = load 'ci/common.groovy'
sh 'env' /* Read the valid NodeJS version */
env.NODE_VERSION = cmn.getToolVersion('node')
/* Cleanup and Prep */
nvm(env.NODE_VERSION) {
desktop.prepDeps() desktop.prepDeps()
} } }
}
} }
} }
stage('Lint') { stage('Lint') {

View File

@ -4,6 +4,14 @@ def version() {
return readFile("${env.WORKSPACE}/VERSION").trim() return readFile("${env.WORKSPACE}/VERSION").trim()
} }
def getToolVersion(name) {
def version = sh(
returnStdout: true,
script: "grep ${name} ${env.WORKSPACE}/.TOOLVERSIONS | cut -d'=' -f2-"
).trim()
return version
}
def getBuildType() { def getBuildType() {
def jobName = env.JOB_NAME def jobName = env.JOB_NAME
if (jobName.contains('e2e')) { if (jobName.contains('e2e')) {