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'
cmn = load 'ci/common.groovy'
print "Running ${cmn.getBuildType()} build!"
/* Cleanup and Prep */
mobile.prep(cmn.getBuildType())
/* Run at start to void mismatched numbers */
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') {
steps {
steps { nvm(env.NODE_VERSION) {
script { cmn.runLint() }
}
} }
}
stage('Tests') {
steps {
steps { nvm(env.NODE_VERSION) {
script { cmn.runTests() }
}
} }
}
stage('Build') {
steps {
steps { nvm(env.NODE_VERSION) {
script { mobile.leinBuild('android') }
}
} }
}
stage('Bundle') {
steps {
steps { nvm(env.NODE_VERSION) {
script { apk = mobile.android.bundle(cmn.getBuildType()) }
}
} }
}
stage('Archive') {
steps {

View File

@ -23,7 +23,6 @@ pipeline {
}
environment {
NODE_VERSION = 'v10.14.1'
BUILD_PLATFORM = 'ios'
LANG = 'en_US.UTF-8'
LANGUAGE = 'en_US.UTF-8'
@ -36,20 +35,24 @@ pipeline {
stages {
stage('Prep') {
steps {
script { nvm(env.NODE_VERSION) {
script {
/* Necessary to load methods */
mobile = load 'ci/mobile.groovy'
cmn = load 'ci/common.groovy'
print "Running ${cmn.getBuildType()} build!"
/* Cleanup and Prep */
mobile.prep(cmn.getBuildType())
/* Run at start to void mismatched numbers */
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') {
steps { nvm(env.NODE_VERSION) {
steps {nvm(env.NODE_VERSION) {
script { cmn.runLint() }
} }
}

View File

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

View File

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

View File

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

View File

@ -4,6 +4,14 @@ def version() {
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 jobName = env.JOB_NAME
if (jobName.contains('e2e')) {