mirror of
https://github.com/status-im/status-app.git
synced 2026-08-27 15:11:20 +00:00
Referenced issue: * https://github.com/status-im/infra-ci/issues/282 Signed-off-by: markoburcul <marko@status.im>
191 lines
5.6 KiB
Groovy
191 lines
5.6 KiB
Groovy
#!/usr/bin/env groovy
|
|
library 'status-jenkins-lib@v1.9.48'
|
|
|
|
QT_VERSION = "6.11.0"
|
|
|
|
/* Options section can't access functions in objects. */
|
|
def isPRBuild = utils.isPRBuild()
|
|
def isNightlyBuild = utils.isNightlyBuild()
|
|
|
|
pipeline {
|
|
agent {
|
|
/* Image with Ubuntu 22.04 and QT ${QT_VERSION} */
|
|
docker {
|
|
label 'linuxcontainer'
|
|
image "harbor.status.im/status-im/status-desktop-build:1.0.8-qt${QT_VERSION}"
|
|
/* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */
|
|
args '--entrypoint="" ' +
|
|
'--cap-add=SYS_ADMIN ' +
|
|
'--security-opt=apparmor:unconfined ' +
|
|
'--device=/dev/fuse ' +
|
|
'--volume=/nix:/nix ' +
|
|
'--volume=/etc/nix:/etc/nix '
|
|
}
|
|
}
|
|
|
|
parameters {
|
|
booleanParam(
|
|
name: 'RELEASE',
|
|
description: 'Decides whether release credentials are used.',
|
|
defaultValue: params.RELEASE ?: false
|
|
)
|
|
booleanParam(
|
|
name: 'INCLUDE_DEBUG_SYMBOLS',
|
|
description: 'Decides whether binaries are built with debug symbols.',
|
|
defaultValue: params.INCLUDE_DEBUG_SYMBOLS ?: false
|
|
)
|
|
choice(
|
|
name: 'VERBOSE',
|
|
description: 'Level of verbosity based on nimbus-build-system setup.',
|
|
choices: ['0', '1', '2']
|
|
)
|
|
string(
|
|
name: 'NIMFLAGS',
|
|
description: 'Extra Nim flags. Examples: --verbosity:2 --passL:"-v" --passC:"-v"',
|
|
defaultValue: ''
|
|
)
|
|
booleanParam(
|
|
name: 'USE_SIMULATED_KEYCARD',
|
|
description: 'Build with the simulated (jcardsim) keycard backend (used by keycard e2e tests).',
|
|
defaultValue: false
|
|
)
|
|
string(
|
|
name: 'STATUS_GO_REF',
|
|
description: 'Override vendor/status-go submodule to this SHA/ref.',
|
|
defaultValue: ''
|
|
)
|
|
}
|
|
|
|
options {
|
|
timestamps()
|
|
/* Prevent Jenkins jobs from running forever */
|
|
timeout(time: 30, unit: 'MINUTES')
|
|
/* manage how many builds we keep */
|
|
buildDiscarder(logRotator(
|
|
numToKeepStr: '10',
|
|
daysToKeepStr: '30',
|
|
artifactNumToKeepStr: '1',
|
|
artifactDaysToKeepStr: '30'
|
|
))
|
|
/* Allows combined build to copy */
|
|
copyArtifactPermission('/status-app/*')
|
|
/* Abort old PR builds. */
|
|
disableConcurrentBuilds(
|
|
abortPrevious: isPRBuild
|
|
)
|
|
disableRestartFromStage()
|
|
}
|
|
|
|
environment {
|
|
PLATFORM = "linux/${getArch()}"
|
|
/* Improve make performance */
|
|
MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE}"
|
|
/* Avoid weird bugs caused by stale cache. */
|
|
QML_DISABLE_DISK_CACHE = "true"
|
|
/* nim-sds source directory */
|
|
NIM_SDS_SOURCE_DIR = "${env.WORKSPACE_TMP}/nim-sds"
|
|
/* sets App Version in Settings */
|
|
VERSION = "${utils.getVersion()}"
|
|
/* Control output the filename */
|
|
APP_TYPE = "${utils.getAppType()}"
|
|
STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'AppImage', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
|
|
STATUS_CLIENT_TARBALL = "pkg/${utils.pkgFilename(ext: 'tar.gz', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
|
|
/* prevent sharing cache dir across different jobs */
|
|
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
|
SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}"
|
|
/* Hack fix for params not being set in job on first run */
|
|
ENTITLEMENTS = "${params.ENTITLEMENTS}"
|
|
RELEASE = "${params.RELEASE}"
|
|
INCLUDE_DEBUG_SYMBOLS = "${params.INCLUDE_DEBUG_SYMBOLS}"
|
|
VERBOSE = "${params.VERBOSE}"
|
|
USE_SIMULATED_KEYCARD = "${params.USE_SIMULATED_KEYCARD}"
|
|
/* FIXME: figure out why NIMFLAGS are not respected */
|
|
XDG_CACHE_HOME = "${env.WORKSPACE_TMP}"
|
|
/* Ensure nimcache is not shared between builds. */
|
|
NIMFLAGS = "${params.NIMFLAGS} --colors:off --nimcache:${env.WORKSPACE_TMP}/nimcache"
|
|
}
|
|
|
|
stages {
|
|
stage('Cleanup Workspace') {
|
|
steps {
|
|
sh './scripts/clean-git.sh'
|
|
}
|
|
}
|
|
stage('Fetch submodules') {
|
|
steps {
|
|
sh 'git submodule update --init --recursive'
|
|
}
|
|
}
|
|
stage('Override status-go ref') {
|
|
when { expression { params.STATUS_GO_REF?.trim() } }
|
|
steps {
|
|
sh "./scripts/override-status-go-ref.sh ${params.STATUS_GO_REF}"
|
|
}
|
|
}
|
|
stage('Deps') {
|
|
steps {
|
|
sh 'make update'
|
|
sh 'make deps'
|
|
}
|
|
}
|
|
|
|
stage('status-go') {
|
|
steps {
|
|
sh 'make status-go'
|
|
}
|
|
}
|
|
|
|
stage('Package') {
|
|
steps { script {
|
|
status.buildSigned(platform='linux', target='tgz-linux')
|
|
} }
|
|
}
|
|
|
|
stage('Parallel Upload') {
|
|
parallel {
|
|
stage('Upload') {
|
|
steps { script {
|
|
env.PKG_URL = s5cmd.upload(env.STATUS_CLIENT_TARBALL)
|
|
jenkins.setBuildDesc(AppImage: env.PKG_URL)
|
|
} }
|
|
}
|
|
stage('Archive') {
|
|
steps { script {
|
|
archiveArtifacts("${env.STATUS_CLIENT_TARBALL}*")
|
|
} }
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('E2E') {
|
|
when { expression { utils.isPRBuild() } }
|
|
steps { script {
|
|
build(
|
|
job: 'status-app/e2e/prs',
|
|
wait: false,
|
|
parameters: jenkins.mapToParams([
|
|
GIT_REF: env.CHANGE_BRANCH ?: env.BRANCH_NAME,
|
|
BUILD_SOURCE: env.JOB_NAME,
|
|
]),
|
|
)
|
|
} }
|
|
}
|
|
}
|
|
post {
|
|
success { script { github.notifyPR(true) } }
|
|
failure { script { github.notifyPR(false) } }
|
|
cleanup {
|
|
cleanWs(disableDeferredWipeout: true)
|
|
dir(env.WORKSPACE_TMP) { deleteDir() }
|
|
}
|
|
}
|
|
}
|
|
|
|
def getArch() {
|
|
def tokens = Thread.currentThread().getName().split('/')
|
|
for (def arch in ['x86_64', 'aarch64']) {
|
|
if (tokens.contains(arch)) { return arch }
|
|
}
|
|
}
|
|
|