From 5440378bbca82f771e2896c5d84d0af4b9334939 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Tue, 5 Mar 2019 19:00:20 +0100 Subject: [PATCH] Migrate remaining CI builds to Nix --- ci/Jenkinsfile.ios | 27 +++++++++++------------ ci/Jenkinsfile.macos | 23 ++++++++----------- ci/Jenkinsfile.windows | 3 +++ scripts/lib/setup/nix/desktop/default.nix | 4 ++-- scripts/lib/setup/nix/mobile/default.nix | 9 ++++---- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 25a013a7ac..cb522bfe8e 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -23,9 +23,11 @@ pipeline { environment { TARGET_PLATFORM = '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}/scripts/lib/setup/nix" FASTLANE_DISABLE_COLORS=1 REALM_DISABLE_ANALYTICS=1 BUNDLE_PATH = "${HOME}/.bundle" @@ -41,34 +43,31 @@ pipeline { btype = cmn.utils.getBuildType() print "Running ${btype} build!" cmn.ci.abortPreviousRunningBuilds() - /* Read the valid NodeJS version */ - env.NODE_VERSION = cmn.utils.getToolVersion('node') /* Cleanup and Prep */ - nvm(env.NODE_VERSION) { - mobile.prep(btype) - } + cmn.prepNixEnvironment() + mobile.prep(btype) } } } stage('Lint') { - steps {nvm(env.NODE_VERSION) { + steps { script { cmn.utils.nix_sh('lein cljfmt check') } - } } + } } stage('Tests') { - steps { nvm(env.NODE_VERSION) { + steps { script { cmn.utils.nix_sh('lein test-cljs') } - } } + } } stage('Build') { - steps { nvm(env.NODE_VERSION) { - sh "lein prod-build-ios" - } } + steps { + script { cmn.utils.nix_sh('lein prod-build-ios') } + } } stage('Bundle') { - steps { nvm(env.NODE_VERSION) { + steps { script { api = mobile.ios.bundle(btype) } - } } + } } stage('Archive') { steps { diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index e13fa079a2..24f4562852 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -23,12 +23,11 @@ pipeline { environment { TARGET_PLATFORM = 'macos' + CI_ENVIRONMENT = 'jenkins' LANG = 'en_US.UTF-8' LANGUAGE = 'en_US.UTF-8' LC_ALL = 'en_US.UTF-8' - QT_PATH = '/usr/local/opt/qt' - PATH = "/usr/local/opt/qt/bin:${env.PATH}" - MACDEPLOYQT = '/usr/local/opt/qt/bin/macdeployqt' + NIX_CONF_DIR = "${env.WORKSPACE}/scripts/lib/setup/nix" VERBOSE_LEVEL = '3' } @@ -42,30 +41,26 @@ pipeline { btype = cmn.utils.getBuildType() print "Running ${btype} build!" cmn.ci.abortPreviousRunningBuilds() - /* Read the valid NodeJS version */ - env.NODE_VERSION = cmn.utils.getToolVersion('node') /* Cleanup and Prep */ cmn.prepNixEnvironment() - nvm(env.NODE_VERSION) { - desktop.prepDeps() - } + desktop.prepDeps() } } } stage('Lint') { - steps { nvm(env.NODE_VERSION) { + steps { script { cmn.utils.nix_sh('lein cljfmt check') } - } } + } } stage('Tests') { - steps { nvm(env.NODE_VERSION) { + steps { script { cmn.utils.nix_sh('lein test-cljs') } - } } + } } stage('Build') { - steps { nvm(env.NODE_VERSION) { + steps { script { desktop.buildClojureScript() } - } } + } } stage('Compile') { steps { diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index b475e28a82..ab19e9c0dd 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -36,11 +36,13 @@ pipeline { **/ environment { TARGET_PLATFORM = '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}/scripts/lib/setup/nix" TARGET_SYSTEM_NAME = 'Windows' CONAN_PRINT_RUN_COMMANDS = '1' CONAN_SYSREQUIRES_MODE = 'disabled' @@ -59,6 +61,7 @@ pipeline { print "Running ${btype} build!" cmn.ci.abortPreviousRunningBuilds() /* Cleanup and Prep */ + cmn.prepNixEnvironment() desktop.prepDeps() } } diff --git a/scripts/lib/setup/nix/desktop/default.nix b/scripts/lib/setup/nix/desktop/default.nix index 01e7075ebe..db9dc59ab9 100644 --- a/scripts/lib/setup/nix/desktop/default.nix +++ b/scripts/lib/setup/nix/desktop/default.nix @@ -6,11 +6,11 @@ with stdenv; let targetLinux = { "linux" = true; - "" = true; + "" = isLinux; }.${target-os} or false; targetWindows = { "windows" = true; - "" = true; + "" = isLinux; }.${target-os} or false; windowsPlatform = callPackage ./windows { }; appimagekit = callPackage ./appimagekit { }; diff --git a/scripts/lib/setup/nix/mobile/default.nix b/scripts/lib/setup/nix/mobile/default.nix index 17754d0591..bfcbacfcfe 100644 --- a/scripts/lib/setup/nix/mobile/default.nix +++ b/scripts/lib/setup/nix/mobile/default.nix @@ -12,10 +12,11 @@ let in { - buildInputs = lib.optional targetAndroid [ - android-ndk - openjdk - ]; + buildInputs = [ bundler ] ++ + lib.optional targetAndroid [ + android-ndk + openjdk + ]; shellHook = lib.optionalString targetAndroid '' export JAVA_HOME="${openjdk}" export ANDROID_HOME=~/.status/Android/Sdk