From 7d16216c3b3c4d740bbd7ebae5b9d24f871908a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 6 Jul 2020 10:48:42 +0200 Subject: [PATCH] add support for posting PR builds in GitHub comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- ci/Dockerfile | 2 +- ci/Jenkinsfile.linux | 24 +++++++++++++++++++----- ci/Jenkinsfile.macos | 24 +++++++++++++++++++----- ci/lib.groovy | 24 ------------------------ 4 files changed, 39 insertions(+), 35 deletions(-) delete mode 100644 ci/lib.groovy diff --git a/ci/Dockerfile b/ci/Dockerfile index 8489db0205..96eb34ed10 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -6,7 +6,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && sudo add-apt-repository -y ppa:git-core/ppa \ && sudo apt update -yq \ && sudo apt install -yq --fix-missing \ - build-essential cmake git libpcre3-dev + build-essential cmake git libpcre3-dev s3cmd # Installing Golang RUN GOLANG_SHA256="aed845e4185a0b2a3c3d5e1d0a35491702c55889192bb9c30e67a3de6849c067" \ diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index 1db0262844..dac61f767c 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -1,3 +1,5 @@ +library 'status-react-jenkins@v1.2.0' + pipeline { agent { docker { @@ -20,6 +22,7 @@ pipeline { } environment { + TARGET = 'linux' /* Improve make performance */ MAKEFLAGS = '-j4' /* Disable colors in Nim compiler logs */ @@ -29,7 +32,7 @@ pipeline { /* Makefile assumes the compiler folder is included */ QTDIR = "/opt/qt/5.14.0/gcc_64" /* Control output the filename */ - STATUS_CLIENT_APPIMAGE = "pkg/${load('ci/lib.groovy').pkgFilename('linux', 'AppImage')}" + STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename('AppImage')}" } stages { @@ -62,13 +65,24 @@ pipeline { steps { sh 'make pkg-linux' } } - stage('Archive') { - steps { script { - archiveArtifacts(env.STATUS_CLIENT_APPIMAGE) - } } + stage('Parallel Upload') { + parallel { + stage('Upload') { + steps { script { + env.PKG_URL = s3.uploadArtifact(env.STATUS_CLIENT_APPIMAGE) + } } + } + stage('Archive') { + steps { script { + archiveArtifacts(env.STATUS_CLIENT_APPIMAGE) + } } + } + } } } post { + success { script { github.notifyPR(true) } } + failure { script { github.notifyPR(false) } } always { cleanWs() } } } diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index 29acd255d1..1e37fc93f9 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -1,3 +1,5 @@ +library 'status-react-jenkins@v1.2.0' + pipeline { agent { label 'macos' @@ -15,6 +17,7 @@ pipeline { } environment { + TARGET = 'macos' /* Improve make performance */ MAKEFLAGS = '-j4' /* Disable colors in Nim compiler logs */ @@ -23,7 +26,7 @@ pipeline { QTDIR = '/usr/local/qt/clang_64' PATH = "${env.QTDIR}/bin:${env.PATH}" /* Control output the filename */ - STATUS_CLIENT_DMG = "pkg/${load('ci/lib.groovy').pkgFilename('macos', 'dmg')}" + STATUS_CLIENT_DMG = "pkg/${utils.pkgFilename('dmg')}" } stages { @@ -71,13 +74,24 @@ pipeline { } } } - stage('Archive') { - steps { script { - archiveArtifacts(env.STATUS_CLIENT_DMG) - } } + stage('Parallel Upload') { + parallel { + stage('Upload') { + steps { script { + env.PKG_URL = s3.uploadArtifact(env.STATUS_CLIENT_DMG) + } } + } + stage('Archive') { + steps { script { + archiveArtifacts(env.STATUS_CLIENT_DMG) + } } + } + } } } post { + success { script { github.notifyPR(true) } } + failure { script { github.notifyPR(false) } } always { cleanWs() } } } diff --git a/ci/lib.groovy b/ci/lib.groovy deleted file mode 100644 index c2d311c0d4..0000000000 --- a/ci/lib.groovy +++ /dev/null @@ -1,24 +0,0 @@ -def parentOrCurrentBuild() { - def c = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause) - if (c == null) { return currentBuild } - return c.getUpstreamRun() -} - -def timestamp() { - /* we use parent if available to make timestmaps consistent */ - def now = new Date(parentOrCurrentBuild().timeInMillis) - return now.format('yyMMdd-HHmmss', TimeZone.getTimeZone('UTC')) -} - -def gitCommit() { - return env.GIT_COMMIT.take(6) -} - -def pkgFilename(type, ext, arch=null) { - /* the grep removes the null arch */ - return [ - "StatusIm", timestamp(), gitCommit(), type, arch, - ].grep().join('-') + ".${ext}" -} - -return this