Configure Jenkins for Windows builds. Part of #5807

This commit is contained in:
Pedro Pombeiro 2018-11-06 22:29:16 +01:00
parent d0f78445d4
commit b8f6eb8d24
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
10 changed files with 135 additions and 13 deletions

2
.gitignore vendored
View File

@ -59,7 +59,7 @@ shim.js
# Desktop build # Desktop build
index.desktop.js index.desktop.js
desktop/docker/*.run desktop/docker/linux/*.run
# Generated by lein voom # Generated by lein voom
# #

View File

@ -4,7 +4,7 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
/* Prevent Jenkins jobs from running forever */ /* Prevent Jenkins jobs from running forever */
timeout(time: 35, unit: 'MINUTES') timeout(time: 45, unit: 'MINUTES')
/* Limit builds retained */ /* Limit builds retained */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '10', numToKeepStr: '10',
@ -38,6 +38,11 @@ pipeline {
steps { script { steps { script {
nix = cmn.buildBranch('status-react/combined/desktop-linux') 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 { stage('iOS') { steps { script {
ios = cmn.buildBranch('status-react/combined/mobile-ios') ios = cmn.buildBranch('status-react/combined/mobile-ios')
} } } } } }
@ -56,6 +61,7 @@ pipeline {
if (btype != 'release') { if (btype != 'release') {
cmn.copyArts('status-react/combined/desktop-macos', osx.number) cmn.copyArts('status-react/combined/desktop-macos', osx.number)
cmn.copyArts('status-react/combined/desktop-linux', nix.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-ios', ios.number)
cmn.copyArts('status-react/combined/mobile-android', dro.number) cmn.copyArts('status-react/combined/mobile-android', dro.number)
@ -72,20 +78,22 @@ pipeline {
if (btype != 'release') { if (btype != 'release') {
dmgUrl = cmn.uploadArtifact(cmn.pkgFind('dmg')) dmgUrl = cmn.uploadArtifact(cmn.pkgFind('dmg'))
appUrl = cmn.uploadArtifact(cmn.pkgFind('AppImage')) appUrl = cmn.uploadArtifact(cmn.pkgFind('AppImage'))
zipUrl = cmn.uploadArtifact(cmn.pkgFind('zip'))
} else { } else {
dmgUrl = null dmgUrl = null
appUrl = null appUrl = null
zipUrl = null
} }
/* special case for iOS Diawi links */ /* special case for iOS Diawi links */
ipaUrl = ios.getBuildVariables().get('DIAWI_URL') ipaUrl = ios.getBuildVariables().get('DIAWI_URL')
/* add URLs to the build description */ /* add URLs to the build description */
cmn.setBuildDesc( 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 */ /* Create latest.json with newest nightly URLs */
if (btype == 'nightly') { if (btype == 'nightly') {
cmn.updateLatestNightlies( 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 { steps { script {
if (env.CHANGE_ID != null) { if (env.CHANGE_ID != null) {
cmn.githubNotify( cmn.githubNotify(
apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, zipUrl,
env.CHANGE_ID env.CHANGE_ID
) )
} }

87
ci/Jenkinsfile.windows Normal file
View File

@ -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 }
}
}
}

View File

@ -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')]) { withCredentials([string(credentialsId: 'GIT_HUB_TOKEN', variable: 'githubToken')]) {
def message = ( def message = (
"#### :white_check_mark: CI BUILD SUCCESSFUL\\n" + "#### :white_check_mark: CI BUILD SUCCESSFUL\\n" +
@ -151,11 +151,12 @@ def githubNotify(apkUrl, e2eUrl, ipaUrl, dmgUrl, appUrl, changeId) {
"* [Android](${apkUrl}), ([e2e](${e2eUrl}))\\n" + "* [Android](${apkUrl}), ([e2e](${e2eUrl}))\\n" +
"* [iOS](${ipaUrl})\\n") "* [iOS](${ipaUrl})\\n")
if (dmgUrl != null && appUrl != null) { if (dmgUrl != null && appUrl != null && zipUrl != null) {
message = message + message = message +
"##### Desktop\\n" + "##### Desktop\\n" +
"* [MacOS](${dmgUrl})\\n" + "* [MacOS](${dmgUrl})\\n" +
"* [AppImage](${appUrl})" "* [AppImage](${appUrl})\\n" +
"* [Windows](${zipUrl})"
} }
def script = ( def script = (
"curl "+ "curl "+

View File

@ -60,6 +60,17 @@ def compile() {
sh './scripts/build-desktop.sh 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 bundleLinux(type = 'nightly') {
def pkg def pkg

View File

@ -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 && \ RUN ln -s /opt/qt/mkspecs /usr/local/mkspecs && \
ln -s /opt/qt/plugins /usr/local/plugins ln -s /opt/qt/plugins /usr/local/plugins
ENV LANG en_US.UTF-8 \ ENV LANG en_US.UTF-8
LC_ALL en_US.UTF-8 \ ENV LC_ALL en_US.UTF-8
LANGUAGE en_US.UTF-8 \ ENV LANGUAGE en_US.UTF-8
LEIN_HOME /var/tmp/lein \ ENV LEIN_HOME /var/tmp/lein
NPM_CONFIG_CACHE /var/tmp/npm ENV NPM_CONFIG_CACHE /var/tmp/npm
# We have to do this because Jenkins doesn't let us # We have to do this because Jenkins doesn't let us
# https://issues.jenkins-ci.org/browse/JENKINS-49076 # https://issues.jenkins-ci.org/browse/JENKINS-49076

View File

@ -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)

View File

@ -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.