diff --git a/.gitignore b/.gitignore index c30a81bc1d..187a11d751 100644 --- a/.gitignore +++ b/.gitignore @@ -59,7 +59,7 @@ shim.js # Desktop build index.desktop.js -desktop/docker/*.run +desktop/docker/linux/*.run # Generated by lein voom # diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index a1625a9a02..12aa4b1773 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -4,7 +4,7 @@ pipeline { options { disableConcurrentBuilds() /* Prevent Jenkins jobs from running forever */ - timeout(time: 35, unit: 'MINUTES') + timeout(time: 45, unit: 'MINUTES') /* Limit builds retained */ buildDiscarder(logRotator( numToKeepStr: '10', @@ -38,6 +38,11 @@ pipeline { steps { script { nix = cmn.buildBranch('status-react/combined/desktop-linux') } } } + stage('Windows') { + when { expression { btype != 'release' } } + steps { script { + win = cmn.buildBranch('status-react/combined/desktop-windows') + } } } stage('iOS') { steps { script { ios = cmn.buildBranch('status-react/combined/mobile-ios') } } } @@ -56,6 +61,7 @@ pipeline { if (btype != 'release') { cmn.copyArts('status-react/combined/desktop-macos', osx.number) cmn.copyArts('status-react/combined/desktop-linux', nix.number) + cmn.copyArts('status-react/combined/desktop-windows', win.number) } cmn.copyArts('status-react/combined/mobile-ios', ios.number) cmn.copyArts('status-react/combined/mobile-android', dro.number) @@ -72,20 +78,22 @@ pipeline { if (btype != 'release') { dmgUrl = cmn.uploadArtifact(cmn.pkgFind('dmg')) appUrl = cmn.uploadArtifact(cmn.pkgFind('AppImage')) + zipUrl = cmn.uploadArtifact(cmn.pkgFind('zip')) } else { dmgUrl = null appUrl = null + zipUrl = null } /* special case for iOS Diawi links */ ipaUrl = ios.getBuildVariables().get('DIAWI_URL') /* add URLs to the build description */ cmn.setBuildDesc( - Apk: apkUrl, e2e: e2eUrl, iOS: ipaUrl, App: appUrl, Mac: dmgUrl, + Apk: apkUrl, e2e: e2eUrl, iOS: ipaUrl, App: appUrl, Mac: dmgUrl, Win: zipUrl, ) /* Create latest.json with newest nightly URLs */ if (btype == 'nightly') { cmn.updateLatestNightlies( - APK: apkUrl, IOS: ipaUrl, APP: appUrl, MAC: dmgUrl + APK: apkUrl, IOS: ipaUrl, APP: appUrl, MAC: dmgUrl, Win: zipUrl ) } } } @@ -94,7 +102,7 @@ pipeline { steps { script { if (env.CHANGE_ID != null) { cmn.githubNotify( - apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, + apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, zipUrl, env.CHANGE_ID ) } diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows new file mode 100644 index 0000000000..e730fdb1e6 --- /dev/null +++ b/ci/Jenkinsfile.windows @@ -0,0 +1,87 @@ +pipeline { + agent { + /* privileged mode is necessary for fuse */ + docker { + label 'linux-new' + image 'statusteam/windows-desktop-ubuntu:1.0.0' + args ( + "--privileged "+ + "-v /dev/fuse:/dev/fuse "+ + "-v /var/tmp/lein:/var/tmp/lein:rw "+ + "-v /var/tmp/npm:/var/tmp/npm:rw "+ + "-v /opt/StatusIm-Windows-base-image.zip:/opt/StatusIm-Windows-base-image.zip:ro" + ) + } + } + + options { + /* Prevent Jenkins jobs from running forever */ + timeout(time: 45, unit: 'MINUTES') + /* Limit builds retained */ + buildDiscarder(logRotator( + numToKeepStr: '60', + daysToKeepStr: '30', + artifactNumToKeepStr: '60', + )) + } + + /** + * WARNING: Jenkins ignores PATH changes in Docker + * https://issues.jenkins-ci.org/browse/JENKINS-49076 + **/ + environment { + BUILD_PLATFORM = 'linux' + 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' + TARGET_SYSTEM_NAME = 'Windows' + CONAN_PRINT_RUN_COMMANDS = '1' + CONAN_SYSREQUIRES_MODE = 'disabled' + CONAN_SYSREQUIRES_SUDO = '0' + STATUSIM_WINDOWS_BASEIMAGE_ZIP = '/opt/StatusIm-Windows-base-image.zip' + } + + stages { + stage('Prep') { + steps { + script { + /* Necessary to load methods */ + desktop = load 'ci/desktop.groovy' + cmn = load 'ci/common.groovy' + sh 'env' + desktop.prepDeps() + } + } + } + stage('Lint') { + steps { + script { cmn.runLint() } + } + } + stage('Tests') { + steps { + script { cmn.runTests() } + } + } + stage('Build') { + steps { + script { desktop.buildClojureScript() } + } + } + stage('Compile') { + steps { + script { desktop.compile() } + } + } + stage('Bundle') { + steps { + script { app = desktop.bundleWindows(cmn.getBuildType()) } + } + } + stage('Archive') { + steps { archiveArtifacts app } + } + } +} diff --git a/ci/common.groovy b/ci/common.groovy index c64be1f81c..53151870cf 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -142,7 +142,7 @@ def pkgFilename(type, ext) { } -def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, changeId) { +def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, zipUrl, changeId) { withCredentials([string(credentialsId: 'GIT_HUB_TOKEN', variable: 'githubToken')]) { def message = ( "#### :white_check_mark: CI BUILD SUCCESSFUL\\n" + @@ -151,11 +151,12 @@ def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, changeId) { "* [Android](${apkUrl}), ([e2e](${e2eUrl}))\\n" + "* [iOS](${ipaUrl})\\n") - if (dmgUrl != null && appUrl != null) { + if (dmgUrl != null && appUrl != null && zipUrl != null) { message = message + "##### Desktop\\n" + "* [MacOS](${dmgUrl})\\n" + - "* [AppImage](${appUrl})" + "* [AppImage](${appUrl})\\n" + + "* [Windows](${zipUrl})" } def script = ( "curl "+ diff --git a/ci/desktop.groovy b/ci/desktop.groovy index fa2b9df9f6..ad152c65a8 100644 --- a/ci/desktop.groovy +++ b/ci/desktop.groovy @@ -60,6 +60,17 @@ def compile() { sh './scripts/build-desktop.sh compile' } +def bundleWindows(type = 'nightly') { + def pkg + + sh './scripts/build-desktop.sh bundle' + dir(packageFolder) { + pkg = common.pkgFilename(type, 'zip') + sh "mv ../Status-Windows-x86_64.zip ${pkg}" + } + return "${packageFolder}/${pkg}".drop(2) +} + def bundleLinux(type = 'nightly') { def pkg diff --git a/desktop/docker/Dockerfile b/desktop/docker/linux/Dockerfile similarity index 96% rename from desktop/docker/Dockerfile rename to desktop/docker/linux/Dockerfile index 618b641eb0..2d4167aa3d 100644 --- a/desktop/docker/Dockerfile +++ b/desktop/docker/linux/Dockerfile @@ -29,11 +29,11 @@ COPY --from=qt_build /opt/qt-all/${QT_VERSION}/gcc_64 /opt/qt RUN ln -s /opt/qt/mkspecs /usr/local/mkspecs && \ ln -s /opt/qt/plugins /usr/local/plugins -ENV LANG en_US.UTF-8 \ - LC_ALL en_US.UTF-8 \ - LANGUAGE en_US.UTF-8 \ - LEIN_HOME /var/tmp/lein \ - NPM_CONFIG_CACHE /var/tmp/npm +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 +ENV LEIN_HOME /var/tmp/lein +ENV NPM_CONFIG_CACHE /var/tmp/npm # We have to do this because Jenkins doesn't let us # https://issues.jenkins-ci.org/browse/JENKINS-49076 diff --git a/desktop/docker/Makefile b/desktop/docker/linux/Makefile similarity index 100% rename from desktop/docker/Makefile rename to desktop/docker/linux/Makefile diff --git a/desktop/docker/README.md b/desktop/docker/linux/README.md similarity index 100% rename from desktop/docker/README.md rename to desktop/docker/linux/README.md diff --git a/desktop/docker/windows/Makefile b/desktop/docker/windows/Makefile new file mode 100644 index 0000000000..63d2e6e771 --- /dev/null +++ b/desktop/docker/windows/Makefile @@ -0,0 +1,12 @@ +GIT_COMMIT = $(shell git rev-parse --short HEAD) + +IMAGE_TAG = 1.0.0 +IMAGE_NAME = statusteam/windows-desktop-ubuntu:$(IMAGE_TAG) + +build: + docker build \ + --label="commit=$(GIT_COMMIT)" \ + -t $(IMAGE_NAME) . + +push: build + docker push $(IMAGE_NAME) diff --git a/desktop/docker/windows/README.md b/desktop/docker/windows/README.md new file mode 100644 index 0000000000..17b01d7d98 --- /dev/null +++ b/desktop/docker/windows/README.md @@ -0,0 +1,3 @@ +# Description + +This dockerfile is used to generate an image based on Ubuntu that will be used by Jenkins to build the Linux version of the desktop app.