add support for posting PR builds in GitHub comments

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-07-06 10:48:42 +02:00 committed by Jakub
parent a342192f43
commit 7d16216c3b
4 changed files with 39 additions and 35 deletions

View File

@ -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" \

View File

@ -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('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() }
}
}

View File

@ -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('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() }
}
}

View File

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