From e1c0dff4066b87ec198b7dd9a31c2f3be75854fa Mon Sep 17 00:00:00 2001 From: George Lipov Date: Tue, 25 Sep 2018 20:01:48 +0300 Subject: [PATCH] Run CLJS unit tests when building desktop Signed-off-by: George Lipov --- ci/Jenkinsfile.android | 10 +++++----- ci/Jenkinsfile.ios | 8 ++++---- ci/Jenkinsfile.linux | 18 ++++++++++++++---- ci/Jenkinsfile.macos | 14 ++++++++++++-- ci/common.groovy | 18 +++++++++++++----- ci/mobile.groovy | 8 -------- 6 files changed, 48 insertions(+), 28 deletions(-) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 8a4988fed5..f15331a4af 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -8,7 +8,7 @@ pipeline { artifactNumToKeepStr: '60', )) } - + environment { LANG = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8' @@ -21,7 +21,7 @@ pipeline { ANDROID_NDK = '/usr/lib/android-ndk' ANDROID_NDK_HOME = '/usr/lib/android-ndk' } - + stages { stage('Prep') { steps { @@ -36,12 +36,12 @@ pipeline { } stage('Lint') { steps { - script { mobile.runLint() } + script { cmn.runLint() } } } stage('Tests') { steps { - script { mobile.runTests() } + script { cmn.runTests() } } } stage('Build') { @@ -69,7 +69,7 @@ pipeline { env.DIAWI_URL = mobile.android.uploadToDiawi(); break; case 'e2e': env.SAUCE_URL = mobile.android.uploadToSauceLabs() - } + } } } } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 5c8c6e2543..7a4bf935c8 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -8,7 +8,7 @@ pipeline { artifactNumToKeepStr: '30', )) } - + environment { LANG = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8' @@ -17,7 +17,7 @@ pipeline { REALM_DISABLE_ANALYTICS=1 BUNDLE_PATH = "${HOME}/.bundle" } - + stages { stage('Prep') { steps { @@ -32,12 +32,12 @@ pipeline { } stage('Lint') { steps { - script { mobile.runLint() } + script { cmn.runLint() } } } stage('Tests') { steps { - script { mobile.runTests() } + script { cmn.runTests() } } } stage('Build') { diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index fceeb2ad65..5d283cda19 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -1,11 +1,11 @@ pipeline { - agent { + agent { /* privileged mode is necessary for fuse */ docker { label 'linux-new' image 'statusteam/linux-desktop-ubuntu:16.04' args ( - "--privileged "+ + "--privileged "+ "-v /dev/fuse:/dev/fuse "+ "-v /var/tmp/lein:/var/tmp/lein:rw "+ "-v /var/tmp/npm:/var/tmp/npm:rw "+ @@ -21,7 +21,7 @@ pipeline { artifactNumToKeepStr: '30', )) } - + /** * WARNING: Jenkins ignores PATH changes in Docker * https://issues.jenkins-ci.org/browse/JENKINS-49076 @@ -35,7 +35,7 @@ pipeline { QT_PATH = '/opt/qt59' STATUSIM_APPIMAGE = '/opt/StatusImAppImage.zip' } - + stages { stage('Prep') { steps { @@ -48,6 +48,16 @@ pipeline { } } } + stage('Lint') { + steps { + script { cmn.runLint() } + } + } + stage('Tests') { + steps { + script { cmn.runTests() } + } + } stage('Build') { steps { script { desktop.buildClojureScript() } diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index 21e16ed443..65e5717845 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -8,7 +8,7 @@ pipeline { artifactNumToKeepStr: '30', )) } - + environment { LANG = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8' @@ -16,7 +16,7 @@ pipeline { QT_PATH = '/Users/administrator/qt/5.9.1' PATH = "${env.QT_PATH}/clang_64/bin:${env.PATH}" } - + stages { stage('Prep') { steps { @@ -28,6 +28,16 @@ pipeline { } } } + stage('Lint') { + steps { + script { cmn.runLint() } + } + } + stage('Tests') { + steps { + script { cmn.runTests() } + } + } stage('Build') { steps { script { desktop.buildClojureScript() } diff --git a/ci/common.groovy b/ci/common.groovy index 656d1a6867..14ec5541a9 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -15,7 +15,7 @@ def getBuildType() { } return params.BUILD_TYPE } - + def buildBranch(name = null, buildType) { /* need to drop origin/ to match definitions of child jobs */ def branchName = env.GIT_BRANCH.replace('origin/', '') @@ -143,13 +143,13 @@ def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, changeId) { "* [AppImage](${appUrl})" } def script = ( - "curl "+ - "-u status-im:${githubToken} " + - "-H 'Content-Type: application/json' " + + "curl "+ + "-u status-im:${githubToken} " + + "-H 'Content-Type: application/json' " + "--data '{\"body\": \"${message}\"}' " + "https://api.github.com/repos/status-im/status-react/issues/${changeId}/comments" ) - def ghOutput = sh(returnStdout: true, script: script) + def ghOutput = sh(returnStdout: true, script: script) println("Result of github comment curl: " + ghOutput); } } @@ -160,4 +160,12 @@ def getParentRunEnv(name) { return c.getUpstreamRun().getEnvironment()[name] } +def runLint() { + sh 'lein cljfmt check' +} + +def runTests() { + sh 'lein test-cljs' +} + return this diff --git a/ci/mobile.groovy b/ci/mobile.groovy index d11336f5c3..02e15813b9 100644 --- a/ci/mobile.groovy +++ b/ci/mobile.groovy @@ -59,14 +59,6 @@ def prep(type = 'nightly') { } } -def runLint() { - sh 'lein cljfmt check' -} - -def runTests() { - sh 'lein test-cljs' -} - def leinBuild(platform) { sh "lein prod-build-${platform}" }