refactor nix_sh to give it optional Map arguments
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
c59f372ef3
commit
0e8e5a51ba
|
@ -22,13 +22,13 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
|
LANG = "en_US.UTF-8"
|
||||||
|
LC_ALL = "en_US.UTF-8"
|
||||||
|
LANGUAGE = "en_US.UTF-8"
|
||||||
TARGET_OS = 'android'
|
TARGET_OS = 'android'
|
||||||
LANG = 'en_US.UTF-8'
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||||
LANGUAGE = 'en_US.UTF-8'
|
|
||||||
LC_ALL = 'en_US.UTF-8'
|
|
||||||
FASTLANE_DISABLE_COLORS = 1
|
FASTLANE_DISABLE_COLORS = 1
|
||||||
REALM_DISABLE_ANALYTICS = 1
|
REALM_DISABLE_ANALYTICS = 1
|
||||||
CI_ENVIRONMENT = 'jenkins'
|
|
||||||
/* since we are mounting it we need to specify location */
|
/* since we are mounting it we need to specify location */
|
||||||
STATUS_RELEASE_STORE_FILE = '/home/jenkins/status-im.keystore'
|
STATUS_RELEASE_STORE_FILE = '/home/jenkins/status-im.keystore'
|
||||||
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
||||||
|
@ -54,17 +54,17 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Lint') {
|
stage('Lint') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein cljfmt check') }
|
script { cmn.nix.shell('lein cljfmt check') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein test-cljs') }
|
script { cmn.nix.shell('lein test-cljs') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein prod-build-android') }
|
script { cmn.nix.shell('lein prod-build-android') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Bundle') {
|
stage('Bundle') {
|
||||||
|
|
|
@ -6,7 +6,6 @@ pipeline {
|
||||||
LANGUAGE = "en_US.UTF-8"
|
LANGUAGE = "en_US.UTF-8"
|
||||||
LC_ALL = "en_US.UTF-8"
|
LC_ALL = "en_US.UTF-8"
|
||||||
FASTLANE_DISABLE_COLORS = 1
|
FASTLANE_DISABLE_COLORS = 1
|
||||||
REALM_DISABLE_ANALYTICS = 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
|
|
|
@ -22,15 +22,18 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
|
LANG = "en_US.UTF-8"
|
||||||
|
LC_ALL = "en_US.UTF-8"
|
||||||
|
LANGUAGE = "en_US.UTF-8"
|
||||||
TARGET_OS = 'ios'
|
TARGET_OS = 'ios'
|
||||||
CI_ENVIRONMENT = 'jenkins'
|
|
||||||
LANG = 'en_US.UTF-8'
|
|
||||||
LANGUAGE = 'en_US.UTF-8'
|
|
||||||
LC_ALL = 'en_US.UTF-8'
|
|
||||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||||
FASTLANE_DISABLE_COLORS=1
|
FASTLANE_DISABLE_COLORS = 1
|
||||||
REALM_DISABLE_ANALYTICS=1
|
REALM_DISABLE_ANALYTICS = 1
|
||||||
BUNDLE_PATH = "${HOME}/.bundle"
|
BUNDLE_PATH = "${HOME}/.bundle"
|
||||||
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
||||||
|
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
|
||||||
|
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
|
||||||
|
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
@ -50,17 +53,17 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Lint') {
|
stage('Lint') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein cljfmt check') }
|
script { cmn.nix.shell('lein cljfmt check') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein test-cljs') }
|
script { cmn.nix.shell('lein test-cljs') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein prod-build-ios') }
|
script { cmn.nix.shell('lein prod-build-ios') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Bundle') {
|
stage('Bundle') {
|
||||||
|
|
|
@ -26,15 +26,16 @@ pipeline {
|
||||||
* https://issues.jenkins-ci.org/browse/JENKINS-49076
|
* https://issues.jenkins-ci.org/browse/JENKINS-49076
|
||||||
**/
|
**/
|
||||||
environment {
|
environment {
|
||||||
|
LANG = "en_US.UTF-8"
|
||||||
|
LC_ALL = "en_US.UTF-8"
|
||||||
|
LANGUAGE = "en_US.UTF-8"
|
||||||
TARGET_OS = 'linux'
|
TARGET_OS = 'linux'
|
||||||
LANG = 'en_US.UTF-8'
|
|
||||||
LANGUAGE = 'en_US.UTF-8'
|
|
||||||
LC_ALL = 'en_US.UTF-8'
|
|
||||||
NPM_CONFIG_CACHE = '/var/tmp/npm'
|
|
||||||
CI_ENVIRONMENT = 'jenkins'
|
|
||||||
LEIN_HOME = '/var/tmp/lein'
|
|
||||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||||
VERBOSE_LEVEL = '3'
|
VERBOSE_LEVEL = '3'
|
||||||
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
||||||
|
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
|
||||||
|
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
|
||||||
|
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
@ -54,12 +55,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Lint') {
|
stage('Lint') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein cljfmt check') }
|
script { cmn.nix.shell('lein cljfmt check') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein test-cljs') }
|
script { cmn.nix.shell('lein test-cljs') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
|
|
@ -22,13 +22,16 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
|
LANG = "en_US.UTF-8"
|
||||||
|
LC_ALL = "en_US.UTF-8"
|
||||||
|
LANGUAGE = "en_US.UTF-8"
|
||||||
TARGET_OS = 'macos'
|
TARGET_OS = 'macos'
|
||||||
CI_ENVIRONMENT = 'jenkins'
|
|
||||||
LANG = 'en_US.UTF-8'
|
|
||||||
LANGUAGE = 'en_US.UTF-8'
|
|
||||||
LC_ALL = 'en_US.UTF-8'
|
|
||||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||||
VERBOSE_LEVEL = '3'
|
VERBOSE_LEVEL = '3'
|
||||||
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
||||||
|
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
|
||||||
|
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
|
||||||
|
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
@ -48,12 +51,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Lint') {
|
stage('Lint') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein cljfmt check') }
|
script { cmn.nix.shell('lein cljfmt check') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein test-cljs') }
|
script { cmn.nix.shell('lein test-cljs') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
|
|
@ -2,7 +2,6 @@ pipeline {
|
||||||
agent { label params.AGENT_LABEL }
|
agent { label params.AGENT_LABEL }
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
CI_ENVIRONMENT = 'jenkins'
|
|
||||||
/* we source .bash_profile to be able to use nix-store */
|
/* we source .bash_profile to be able to use nix-store */
|
||||||
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .bash_profile;"
|
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .bash_profile;"
|
||||||
/* where our /nix/store is hosted */
|
/* where our /nix/store is hosted */
|
||||||
|
|
|
@ -26,18 +26,20 @@ pipeline {
|
||||||
* https://issues.jenkins-ci.org/browse/JENKINS-49076
|
* https://issues.jenkins-ci.org/browse/JENKINS-49076
|
||||||
**/
|
**/
|
||||||
environment {
|
environment {
|
||||||
|
LANG = "en_US.UTF-8"
|
||||||
|
LC_ALL = "en_US.UTF-8"
|
||||||
|
LANGUAGE = "en_US.UTF-8"
|
||||||
TARGET_OS = 'windows'
|
TARGET_OS = 'windows'
|
||||||
CI_ENVIRONMENT = 'jenkins'
|
|
||||||
LANG = 'en_US.UTF-8'
|
|
||||||
LANGUAGE = 'en_US.UTF-8'
|
|
||||||
LC_ALL = 'en_US.UTF-8'
|
|
||||||
NPM_CONFIG_CACHE = '/var/tmp/npm'
|
|
||||||
LEIN_HOME = '/var/tmp/lein'
|
|
||||||
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
||||||
|
VERBOSE_LEVEL = '3'
|
||||||
|
/* Conan settings */
|
||||||
CONAN_PRINT_RUN_COMMANDS = '1'
|
CONAN_PRINT_RUN_COMMANDS = '1'
|
||||||
CONAN_SYSREQUIRES_MODE = 'disabled'
|
CONAN_SYSREQUIRES_MODE = 'disabled'
|
||||||
CONAN_SYSREQUIRES_SUDO = '0'
|
CONAN_SYSREQUIRES_SUDO = '0'
|
||||||
VERBOSE_LEVEL = '3'
|
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
|
||||||
|
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
|
||||||
|
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
|
||||||
|
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
@ -57,12 +59,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Lint') {
|
stage('Lint') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein cljfmt check') }
|
script { cmn.nix.shell('lein cljfmt check') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
steps {
|
steps {
|
||||||
script { cmn.utils.nix_sh('lein test-cljs') }
|
script { cmn.nix.shell('lein test-cljs') }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
nix = load 'ci/nix.groovy'
|
||||||
utils = load 'ci/utils.groovy'
|
utils = load 'ci/utils.groovy'
|
||||||
|
|
||||||
def bundle() {
|
def bundle() {
|
||||||
|
@ -24,7 +25,14 @@ def bundle() {
|
||||||
passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD'
|
passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD'
|
||||||
)
|
)
|
||||||
]) {
|
]) {
|
||||||
utils.nix_sh "./gradlew assemble${target.capitalize()} ${gradleOpt}"
|
nix.shell(
|
||||||
|
"./gradlew assemble${target.capitalize()} ${gradleOpt}",
|
||||||
|
keep: [
|
||||||
|
'REALM_DISABLE_ANALYTICS',
|
||||||
|
'STATUS_RELEASE_STORE_FILE', 'STATUS_RELEASE_STORE_PASSWORD',
|
||||||
|
'STATUS_RELEASE_KEY_ALIAS', 'STATUS_RELEASE_KEY_PASSWORD'
|
||||||
|
]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sh 'find android/app/build/outputs/apk'
|
sh 'find android/app/build/outputs/apk'
|
||||||
|
@ -34,7 +42,6 @@ def bundle() {
|
||||||
sh "cp ${outApk} ${pkg}"
|
sh "cp ${outApk} ${pkg}"
|
||||||
/* necessary for Fastlane */
|
/* necessary for Fastlane */
|
||||||
env.APK_PATH = pkg
|
env.APK_PATH = pkg
|
||||||
env.DIAWI_APK = pkg
|
|
||||||
return pkg
|
return pkg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +49,10 @@ def uploadToPlayStore(type = 'nightly') {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
string(credentialsId: "SUPPLY_JSON_KEY_DATA", variable: 'GOOGLE_PLAY_JSON_KEY'),
|
string(credentialsId: "SUPPLY_JSON_KEY_DATA", variable: 'GOOGLE_PLAY_JSON_KEY'),
|
||||||
]) {
|
]) {
|
||||||
utils.nix_fastlane_sh "android ${type}"
|
nix.shell(
|
||||||
|
"fastlane android ${type}",
|
||||||
|
keep: ['FASTLANE_DISABLE_COLORS', 'GOOGLE_PLAY_JSON_KEY']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +68,13 @@ def uploadToSauceLabs() {
|
||||||
string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'),
|
string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'),
|
||||||
string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'),
|
string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'),
|
||||||
]) {
|
]) {
|
||||||
utils.nix_fastlane_sh 'android saucelabs'
|
nix.shell(
|
||||||
|
'fastlane android saucelabs',
|
||||||
|
keep: [
|
||||||
|
'FASTLANE_DISABLE_COLORS', 'APK_PATH',
|
||||||
|
'SAUCE_ACCESS_KEY', 'SAUCE_USERNAME', 'SAUCE_LABS_NAME'
|
||||||
|
]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return env.SAUCE_LABS_NAME
|
return env.SAUCE_LABS_NAME
|
||||||
}
|
}
|
||||||
|
@ -68,7 +84,10 @@ def uploadToDiawi() {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
|
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
|
||||||
]) {
|
]) {
|
||||||
utils.nix_fastlane_sh 'android upload_diawi'
|
nix.shell(
|
||||||
|
'fastlane android upload_diawi',
|
||||||
|
keep: ['FASTLANE_DISABLE_COLORS', 'APK_PATH', 'DIAWI_TOKEN']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
||||||
return diawiUrl
|
return diawiUrl
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import groovy.json.JsonBuilder
|
import groovy.json.JsonBuilder
|
||||||
|
|
||||||
|
/* Libraries -----------------------------------------------------------------*/
|
||||||
|
|
||||||
gh = load 'ci/github.groovy'
|
gh = load 'ci/github.groovy'
|
||||||
ci = load 'ci/jenkins.groovy'
|
ci = load 'ci/jenkins.groovy'
|
||||||
gh = load 'ci/github.groovy'
|
gh = load 'ci/github.groovy'
|
||||||
|
nix = load 'ci/nix.groovy'
|
||||||
utils = load 'ci/utils.groovy'
|
utils = load 'ci/utils.groovy'
|
||||||
ghcmgr = load 'ci/ghcmgr.groovy'
|
ghcmgr = load 'ci/ghcmgr.groovy'
|
||||||
|
|
||||||
|
@ -42,19 +45,9 @@ def notifyPR(success) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def prepNixEnvironment() {
|
|
||||||
if (env.TARGET_OS == 'linux' || env.TARGET_OS == 'windows' || env.TARGET_OS == 'android') {
|
|
||||||
def glibcLocales = sh(
|
|
||||||
returnStdout: true,
|
|
||||||
script: ". ~/.nix-profile/etc/profile.d/nix.sh && nix-build --no-out-link '<nixpkgs>' -A glibcLocales"
|
|
||||||
).trim()
|
|
||||||
env.LOCALE_ARCHIVE_2_27 = "${glibcLocales}/lib/locale/locale-archive"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def prep(type = 'nightly') {
|
def prep(type = 'nightly') {
|
||||||
/* build/downloads all nix deps in advance */
|
/* build/downloads all nix deps in advance */
|
||||||
prepNixEnvironment()
|
nix.prepEnv()
|
||||||
/* rebase unless this is a release build */
|
/* rebase unless this is a release build */
|
||||||
utils.doGitRebase()
|
utils.doGitRebase()
|
||||||
/* ensure that we start from a known state */
|
/* ensure that we start from a known state */
|
||||||
|
@ -69,7 +62,7 @@ def prep(type = 'nightly') {
|
||||||
|
|
||||||
if (env.TARGET_OS == 'ios') {
|
if (env.TARGET_OS == 'ios') {
|
||||||
/* install ruby dependencies */
|
/* install ruby dependencies */
|
||||||
utils.nix_sh 'bundle install --gemfile=fastlane/Gemfile --quiet'
|
nix.shell 'bundle install --gemfile=fastlane/Gemfile --quiet'
|
||||||
}
|
}
|
||||||
|
|
||||||
def prepareTarget=env.TARGET_OS
|
def prepareTarget=env.TARGET_OS
|
||||||
|
@ -77,7 +70,7 @@ def prep(type = 'nightly') {
|
||||||
prepareTarget='desktop'
|
prepareTarget='desktop'
|
||||||
}
|
}
|
||||||
/* node deps, pods, and status-go download */
|
/* node deps, pods, and status-go download */
|
||||||
utils.nix_impure_sh "scripts/prepare-for-platform.sh ${prepareTarget}"
|
utils.nix.shell("scripts/prepare-for-platform.sh ${prepareTarget}", pure: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return this
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
utils = load 'ci/utils.groovy'
|
nix = load 'ci/nix.groovy'
|
||||||
cmn = load 'ci/common.groovy'
|
cmn = load 'ci/common.groovy'
|
||||||
|
utils = load 'ci/utils.groovy'
|
||||||
|
|
||||||
packageFolder = './StatusImPackage'
|
packageFolder = './StatusImPackage'
|
||||||
|
|
||||||
def cleanupAndDeps() {
|
def cleanupAndDeps() {
|
||||||
sh 'make clean'
|
sh 'make clean'
|
||||||
sh 'cp .env.jenkins .env'
|
sh 'cp .env.jenkins .env'
|
||||||
utils.nix_sh 'lein deps'
|
nix.shell 'lein deps'
|
||||||
utils.installJSDeps('desktop')
|
utils.installJSDeps('desktop')
|
||||||
}
|
}
|
||||||
|
|
||||||
def buildClojureScript() {
|
def buildClojureScript() {
|
||||||
utils.nix_sh '''
|
nix.shell(
|
||||||
make prod-build-desktop && \
|
'''
|
||||||
./scripts/build-desktop.sh buildClojureScript
|
make prod-build-desktop && \
|
||||||
'''
|
./scripts/build-desktop.sh buildClojureScript
|
||||||
|
''',
|
||||||
|
keep: ['VERBOSE_LEVEL']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def uploadArtifact(filename) {
|
def uploadArtifact(filename) {
|
||||||
|
@ -51,13 +55,19 @@ def compile() {
|
||||||
if (env.QT_PATH) {
|
if (env.QT_PATH) {
|
||||||
env.PATH = "${env.QT_PATH}:${env.PATH}"
|
env.PATH = "${env.QT_PATH}:${env.PATH}"
|
||||||
}
|
}
|
||||||
utils.nix_sh './scripts/build-desktop.sh compile'
|
nix.shell(
|
||||||
|
'./scripts/build-desktop.sh compile',
|
||||||
|
keep: ['VERBOSE_LEVEL']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def bundleWindows(type = 'nightly') {
|
def bundleWindows(type = 'nightly') {
|
||||||
def pkg
|
def pkg
|
||||||
|
|
||||||
utils.nix_sh './scripts/build-desktop.sh bundle'
|
nix.shell(
|
||||||
|
'./scripts/build-desktop.sh bundle',
|
||||||
|
keep: ['VERBOSE_LEVEL']
|
||||||
|
)
|
||||||
dir(packageFolder) {
|
dir(packageFolder) {
|
||||||
pkg = utils.pkgFilename(type, 'exe')
|
pkg = utils.pkgFilename(type, 'exe')
|
||||||
sh "mv ../Status-x86_64-setup.exe ${pkg}"
|
sh "mv ../Status-x86_64-setup.exe ${pkg}"
|
||||||
|
@ -67,7 +77,10 @@ def bundleWindows(type = 'nightly') {
|
||||||
|
|
||||||
def bundleLinux(type = 'nightly') {
|
def bundleLinux(type = 'nightly') {
|
||||||
def pkg
|
def pkg
|
||||||
utils.nix_sh './scripts/build-desktop.sh bundle'
|
nix.shell(
|
||||||
|
'./scripts/build-desktop.sh bundle',
|
||||||
|
keep: ['VERBOSE_LEVEL']
|
||||||
|
)
|
||||||
dir(packageFolder) {
|
dir(packageFolder) {
|
||||||
pkg = utils.pkgFilename(type, 'AppImage')
|
pkg = utils.pkgFilename(type, 'AppImage')
|
||||||
sh "mv ../Status-x86_64.AppImage ${pkg}"
|
sh "mv ../Status-x86_64.AppImage ${pkg}"
|
||||||
|
@ -77,18 +90,25 @@ def bundleLinux(type = 'nightly') {
|
||||||
|
|
||||||
def bundleMacOS(type = 'nightly') {
|
def bundleMacOS(type = 'nightly') {
|
||||||
def pkg = utils.pkgFilename(type, 'dmg')
|
def pkg = utils.pkgFilename(type, 'dmg')
|
||||||
utils.nix_sh './scripts/build-desktop.sh bundle'
|
nix.shell(
|
||||||
|
'./scripts/build-desktop.sh bundle',
|
||||||
|
keep: ['VERBOSE_LEVEL']
|
||||||
|
)
|
||||||
dir(packageFolder) {
|
dir(packageFolder) {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
string(credentialsId: 'desktop-gpg-outer-pass', variable: 'GPG_PASS_OUTER'),
|
string(credentialsId: 'desktop-gpg-outer-pass', variable: 'GPG_PASS_OUTER'),
|
||||||
string(credentialsId: 'desktop-gpg-inner-pass', variable: 'GPG_PASS_INNER'),
|
string(credentialsId: 'desktop-gpg-inner-pass', variable: 'GPG_PASS_INNER'),
|
||||||
string(credentialsId: 'desktop-keychain-pass', variable: 'KEYCHAIN_PASS')
|
string(credentialsId: 'desktop-keychain-pass', variable: 'KEYCHAIN_PASS')
|
||||||
]) {
|
]) {
|
||||||
utils.nix_impure_sh """
|
nix.shell(
|
||||||
|
"""
|
||||||
../scripts/sign-macos-pkg.sh Status.app ../deployment/macos/macos-developer-id.keychain-db.gpg && \
|
../scripts/sign-macos-pkg.sh Status.app ../deployment/macos/macos-developer-id.keychain-db.gpg && \
|
||||||
../node_modules/appdmg/bin/appdmg.js ../deployment/macos/status-dmg.json ${pkg} && \
|
../node_modules/appdmg/bin/appdmg.js ../deployment/macos/status-dmg.json ${pkg} && \
|
||||||
../scripts/sign-macos-pkg.sh ${pkg} ../deployment/macos/macos-developer-id.keychain-db.gpg
|
../scripts/sign-macos-pkg.sh ${pkg} ../deployment/macos/macos-developer-id.keychain-db.gpg
|
||||||
"""
|
""",
|
||||||
|
pure: false,
|
||||||
|
keep: ['GPG_PASS_OUTER', 'GPG_PASS_INNER', 'KEYCHAIN_PASS']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "${packageFolder}/${pkg}".drop(2)
|
return "${packageFolder}/${pkg}".drop(2)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
nix = load('ci/nix.groovy')
|
||||||
utils = load('ci/utils.groovy')
|
utils = load('ci/utils.groovy')
|
||||||
|
|
||||||
def plutil(name, value) {
|
def plutil(name, value) {
|
||||||
|
@ -16,7 +17,7 @@ def bundle() {
|
||||||
default: target = 'nightly';
|
default: target = 'nightly';
|
||||||
}
|
}
|
||||||
/* configure build metadata */
|
/* configure build metadata */
|
||||||
utils.nix_sh(
|
nix.shell(
|
||||||
plutil('CFBundleShortVersionString', utils.getVersion('mobile_files')) +
|
plutil('CFBundleShortVersionString', utils.getVersion('mobile_files')) +
|
||||||
plutil('CFBundleVersion', utils.genBuildNumber()) +
|
plutil('CFBundleVersion', utils.genBuildNumber()) +
|
||||||
plutil('CFBundleBuildUrl', currentBuild.absoluteUrl)
|
plutil('CFBundleBuildUrl', currentBuild.absoluteUrl)
|
||||||
|
@ -33,7 +34,14 @@ def bundle() {
|
||||||
passwordVariable: 'FASTLANE_PASSWORD'
|
passwordVariable: 'FASTLANE_PASSWORD'
|
||||||
),
|
),
|
||||||
]) {
|
]) {
|
||||||
utils.nix_sh "bundle exec --gemfile=fastlane/Gemfile fastlane ios ${target}"
|
nix.shell(
|
||||||
|
"bundle exec --gemfile=fastlane/Gemfile fastlane ios ${target}",
|
||||||
|
keep: [
|
||||||
|
'FASTLANE_DISABLE_COLORS',
|
||||||
|
'FASTLANE_PASSWORD', 'KEYCHAIN_PASSWORD',
|
||||||
|
'MATCH_PASSWORD', 'FASTLANE_APPLE_ID',
|
||||||
|
]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/* rename built file for uploads and archivization */
|
/* rename built file for uploads and archivization */
|
||||||
def pkg = ''
|
def pkg = ''
|
||||||
|
@ -56,7 +64,10 @@ def uploadToDiawi() {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
|
string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'),
|
||||||
]) {
|
]) {
|
||||||
utils.nix_sh 'bundle exec --gemfile=fastlane/Gemfile fastlane ios upload_diawi'
|
nix.shell(
|
||||||
|
'bundle exec --gemfile=fastlane/Gemfile fastlane ios upload_diawi',
|
||||||
|
keep: ['FASTLANE_DISABLE_COLORS', 'DIAWI_TOKEN']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out"
|
||||||
return diawiUrl
|
return diawiUrl
|
||||||
|
@ -73,7 +84,10 @@ def uploadToSauceLabs() {
|
||||||
string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'),
|
string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'),
|
||||||
string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'),
|
string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'),
|
||||||
]) {
|
]) {
|
||||||
utils.nix_sh 'bundle exec --gemfile=fastlane/Gemfile fastlane ios saucelabs'
|
nix.shell(
|
||||||
|
'bundle exec --gemfile=fastlane/Gemfile fastlane ios saucelabs',
|
||||||
|
keep: ['FASTLANE_DISABLE_COLORS', 'SAUCE_ACCESS_KEY', 'SAUCE_USERNAME']
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return env.SAUCE_LABS_NAME
|
return env.SAUCE_LABS_NAME
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
* Arguments:
|
||||||
|
* - pure - Use --pure mode with Nix for more deterministic behaviour
|
||||||
|
* - keep - List of env variables to keep even in pure mode
|
||||||
|
* - args - Map of arguments to provide to --argstr
|
||||||
|
**/
|
||||||
|
def shell(Map opts = [:], String cmd) {
|
||||||
|
def defaults = [
|
||||||
|
pure: true,
|
||||||
|
args: ['target-os': env.TARGET_OS],
|
||||||
|
keep: ['LOCALE_ARCHIVE_2_27'],
|
||||||
|
]
|
||||||
|
/* merge defaults with received opts */
|
||||||
|
opts = defaults + opts
|
||||||
|
/* Previous merge overwrites the array */
|
||||||
|
opts.keep = (opts.keep + defaults.keep).unique()
|
||||||
|
|
||||||
|
def isPure = opts.pure && env.TARGET_OS != 'windows' && env.TARGET_OS != 'ios'
|
||||||
|
def keepFlags = opts.keep.collect { var -> "--keep ${var} " }
|
||||||
|
def argsFlags = opts.args.collect { key,val -> "--argstr ${key} \'${val}\'" }
|
||||||
|
sh """
|
||||||
|
set +x
|
||||||
|
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||||
|
set -x
|
||||||
|
nix-shell \\
|
||||||
|
${isPure ? "--pure" : ""} \\
|
||||||
|
${keepFlags.join(" ")} \\
|
||||||
|
${argsFlags.join(" ")} \\
|
||||||
|
--run \'${cmd}\' \\
|
||||||
|
\'${env.WORKSPACE}/shell.nix\'
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
def prepEnv() {
|
||||||
|
if (env.TARGET_OS in ['linux', 'windows', 'android']) {
|
||||||
|
def glibcLocales = sh(
|
||||||
|
returnStdout: true,
|
||||||
|
script: """
|
||||||
|
. ~/.nix-profile/etc/profile.d/nix.sh && \\
|
||||||
|
nix-build --no-out-link '<nixpkgs>' -A glibcLocales
|
||||||
|
"""
|
||||||
|
).trim()
|
||||||
|
/**
|
||||||
|
* This is a hack to fix missing locale errors.
|
||||||
|
* See:
|
||||||
|
* - https://github.com/NixOS/nixpkgs/issues/38991
|
||||||
|
* - https://qiita.com/kimagure/items/4449ceb0bda5c10ca50f
|
||||||
|
**/
|
||||||
|
env.LOCALE_ARCHIVE_2_27 = "${glibcLocales}/lib/locale/locale-archive"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
|
@ -1,3 +1,5 @@
|
||||||
|
nix = load 'ci/nix.groovy'
|
||||||
|
|
||||||
def getVersion(type = null) {
|
def getVersion(type = null) {
|
||||||
/* if type is undefined we get VERSION from repo root */
|
/* if type is undefined we get VERSION from repo root */
|
||||||
def path = "${env.WORKSPACE}/VERSION"
|
def path = "${env.WORKSPACE}/VERSION"
|
||||||
|
@ -15,42 +17,6 @@ def getToolVersion(name) {
|
||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
def nix_impure_sh(cmd) {
|
|
||||||
_nix_sh(cmd, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
def nix_sh(cmd) {
|
|
||||||
_nix_sh(cmd, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
def _nix_sh(cmd, forceImpure) {
|
|
||||||
def isPure = !forceImpure && env.TARGET_OS != 'windows' && env.TARGET_OS != 'ios'
|
|
||||||
def pureFlag = isPure ? '--pure --keep LOCALE_ARCHIVE_2_27 --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep STATUS_RELEASE_STORE_PASSWORD --keep STATUS_RELEASE_KEY_ALIAS --keep STATUS_RELEASE_KEY_PASSWORD --keep GPG_PASS_OUTER --keep GPG_PASS_INNER --keep KEYCHAIN_PASS --keep VERBOSE_LEVEL' : ''
|
|
||||||
|
|
||||||
sh """
|
|
||||||
set +x
|
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
|
||||||
set -x
|
|
||||||
nix-shell --argstr target-os \'${env.TARGET_OS}\' \\
|
|
||||||
${pureFlag} --run \'${cmd}\' \\
|
|
||||||
\'${env.WORKSPACE}/shell.nix\'
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
|
|
||||||
def nix_fastlane_sh(cmd) {
|
|
||||||
def isPure = env.TARGET_OS != 'ios'
|
|
||||||
def pureFlag = isPure ? '--pure --keep LANG --keep LANGUAGE --keep LC_ALL --keep DIAWI_TOKEN --keep DIAWI_IPA --keep APK_PATH --keep GOOGLE_PLAY_JSON_KEY --keep SAUCE_LABS_NAME --keep SAUCE_USERNAME --keep SAUCE_ACCESS_KEY --keep FASTLANE_DISABLE_COLORS --keep FASTLANE_APPLE_ID --keep FASTLANE_PASSWORD --keep KEYCHAIN_PASSWORD --keep MATCH_PASSWORD --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep GRADLE_USER_HOME' : ''
|
|
||||||
|
|
||||||
sh """
|
|
||||||
set +x
|
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
|
||||||
set -x
|
|
||||||
nix-shell --argstr target-os \'${env.TARGET_OS}\' \\
|
|
||||||
${pureFlag} --run \'fastlane ${cmd}\' \\
|
|
||||||
\'${env.WORKSPACE}/shell.nix\'
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
|
|
||||||
def branchName() {
|
def branchName() {
|
||||||
return env.GIT_BRANCH.replaceAll(/.*origin\//, '')
|
return env.GIT_BRANCH.replaceAll(/.*origin\//, '')
|
||||||
}
|
}
|
||||||
|
@ -136,10 +102,10 @@ def installJSDeps(platform) {
|
||||||
def maxAttempts = 10
|
def maxAttempts = 10
|
||||||
def installed = false
|
def installed = false
|
||||||
/* prepare environment for specific platform build */
|
/* prepare environment for specific platform build */
|
||||||
nix_sh "scripts/prepare-for-platform.sh ${platform}"
|
nix.shell "scripts/prepare-for-platform.sh ${platform}"
|
||||||
while (!installed && attempt <= maxAttempts) {
|
while (!installed && attempt <= maxAttempts) {
|
||||||
println "#${attempt} attempt to install npm deps"
|
println "#${attempt} attempt to install npm deps"
|
||||||
nix_sh 'yarn install --frozen-lockfile'
|
nix.shell 'yarn install --frozen-lockfile'
|
||||||
installed = fileExists('node_modules/web3/index.js')
|
installed = fileExists('node_modules/web3/index.js')
|
||||||
attemp = attempt + 1
|
attemp = attempt + 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,42 +23,43 @@ def unlock_keychain_if_needed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_upload(url, file, user, conn_timeout=5, timeout=60, retries=3)
|
def curl_upload(url, file, auth, conn_timeout=5, timeout=60, retries=3)
|
||||||
begin
|
rval = sh(
|
||||||
return sh(
|
"curl",
|
||||||
"curl",
|
"--silent",
|
||||||
"--fail",
|
"--user", auth,
|
||||||
"--silent",
|
"--write-out", "\nHTTP_CODE:%{http_code}",
|
||||||
"--user", user,
|
"--request", "POST",
|
||||||
"--request", "POST",
|
"--header", "Content-Type: application/octet-stream",
|
||||||
"--header", "Content-Type: application/octet-stream",
|
"--data-binary", "@../#{file}", # `fastlane` is the cwd so we go one folder up
|
||||||
"--data-binary", "@../#{file}", # `fastlane` is the cwd so we go one folder up
|
# we retry few times if upload doesn't succeed in sensible time
|
||||||
# we retry few times if upload doesn't succeed in sensible time
|
"--retry-connrefused", # consider ECONNREFUSED as error too retry
|
||||||
"--retry-connrefused", # consider ECONNREFUSED as error too retry
|
"--connect-timeout", conn_timeout.to_s, # max time in sec. for establishing connection
|
||||||
"--connect-timeout", conn_timeout.to_s, # max time in sec. for establishing connection
|
"--max-time", timeout.to_s, # max time in sec. for whole transfer to take
|
||||||
"--max-time", timeout.to_s, # max time in sec. for whole transfer to take
|
"--retry", retries.to_s, # number of retries to attempt
|
||||||
"--retry", retries.to_s, # number of retries to attempt
|
"--retry-max-time", timeout.to_s, # same as --max-time but for retries
|
||||||
"--retry-max-time", timeout.to_s, # same as --max-time but for retries
|
"--retry-delay", "0", # an exponential backoff algorithm in sec.
|
||||||
"--retry-delay", "0", # an exponential backoff algorithm in sec.
|
url
|
||||||
url
|
)
|
||||||
)
|
# We're not using --fail because it suppresses server response
|
||||||
rescue => error
|
if not rval.include? "HTTP_CODE:200"
|
||||||
UI.error "Error: #{error}"
|
raise "Error:\n#{rval}"
|
||||||
raise
|
|
||||||
end
|
end
|
||||||
|
return rval
|
||||||
end
|
end
|
||||||
|
|
||||||
def retry_curl_upload(url, file, user, conn_timeout=5, timeout=60, retries=3)
|
def retry_curl_upload(url, file, auth, conn_timeout=5, timeout=60, retries=3)
|
||||||
# since curl doesn't retry on connection and operation timeouts we roll our own
|
# since curl doesn't retry on connection and operation timeouts we roll our own
|
||||||
try = 0
|
try = 0
|
||||||
begin
|
begin
|
||||||
return curl_upload(url, file, user, conn_timeout, timeout, retries)
|
return curl_upload(url, file, auth, conn_timeout, timeout, retries)
|
||||||
rescue => error
|
rescue => error
|
||||||
try += 1
|
try += 1
|
||||||
if try <= retries
|
if try <= retries
|
||||||
UI.important "Warning: Retrying cURL upload! (attempt #{try}/#{retries})"
|
UI.important "Warning: Retrying cURL upload! (attempt #{try}/#{retries})"
|
||||||
retry
|
retry
|
||||||
else
|
else
|
||||||
|
UI.error "Error:\n#{error}"
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,6 @@ function exit_unless_os_supported() {
|
||||||
cecho "@red[[This install script is not supported in a pure Nix shell]]"
|
cecho "@red[[This install script is not supported in a pure Nix shell]]"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -28,9 +27,7 @@ function exit_unless_os_supported() {
|
||||||
via apt. To manually install, please visit the docs for more information:]]
|
via apt. To manually install, please visit the docs for more information:]]
|
||||||
|
|
||||||
@blue[[https://status.im/build_status]]"
|
@blue[[https://status.im/build_status]]"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ if [ $_need_curl -eq 1 ] && ! program_exists "curl"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_linux && [ -z "$CI_ENVIRONMENT" ]; then
|
if is_linux && [ -z "$JENKINS_URL" ]; then
|
||||||
watches=$(cat /proc/sys/fs/inotify/max_user_watches)
|
watches=$(cat /proc/sys/fs/inotify/max_user_watches)
|
||||||
required_watches=524288
|
required_watches=524288
|
||||||
if [ $watches -lt $required_watches ]; then
|
if [ $watches -lt $required_watches ]; then
|
||||||
|
|
Loading…
Reference in New Issue