Files
status-app/ci/Jenkinsfile.flatpak
T
Siddarth Kumar c4e0dbeae7 ci: serialise linux and macos jobs and build from system nim
- in linux jobs we serialise `tests-ui`, `tests-nim` and  appImage
`package` into a single workflow.
- in macos job we serialise `iOS`, `MacOS` builds into a single
workflow.
- we use system `nim` for all jobs and dont have to build nim from
nimbus build system each time.
  - installed `nim 2.2.10` on `windows` and `macos` hosts.
  - upgraded nim in Docker images and bumped the harbour tags for
`linux` and `android`.

This will help us avoid checkout and `deps` stage for these jobs and we
can free up slots for other jobs.
This way we can do more work in parallel.

Because of this we save:
- `12` minutes of build time in `linux` job.
- `10` minutes of build time in `macos` job.
- `21` minutes of `nim` compile time in `windows` job.
2026-08-26 15:41:03 +05:30

173 lines
5.1 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.10-qt${QT_VERSION}"
/* --privileged is required because flatpak-builder uses bubblewrap (bwrap) which needs
* the pivot_root syscall. */
args '--entrypoint="" ' +
'--privileged ' +
'--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
)
}
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 60, 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-flatpak/${getArch()}"
/* Improve make performance */
MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE} USE_SYSTEM_NIM=1"
/* Avoid weird bugs caused by stale cache. */
QML_DISABLE_DISK_CACHE = "true"
/* nim-sds source directory: writable, isolated per build, used by status-go's clone-nim-sds */
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()}"
/* Flatpak output and intermediate dirs. */
STATUS_CLIENT_FLATPAK = "pkg/${utils.pkgFilename(ext: 'flatpak', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
FLATPAK_BUILD_DIR = "${env.WORKSPACE_TMP}/flatpak/build-dir"
FLATPAK_REPO_DIR = "${env.WORKSPACE_TMP}/flatpak/repo"
/* 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 './scripts/ci-fetch-submodules.sh'
}
}
stage('Deps') {
steps {
sh 'make update'
sh 'make deps'
}
}
stage('status-go') {
steps {
sh 'make status-go'
}
}
stage('Build') {
steps {
sh 'make nim_status_client'
}
}
stage('Package') {
steps { script {
status.buildSigned(platform='linux', target='flatpak')
} }
}
stage('Distribute') {
parallel {
stage('Upload') {
steps { script {
env.PKG_URL = s5cmd.upload(env.STATUS_CLIENT_FLATPAK)
jenkins.setBuildDesc(Flatpak: env.PKG_URL)
} }
}
stage('Archive') {
steps { script {
archiveArtifacts("${env.STATUS_CLIENT_FLATPAK}*")
} }
}
}
}
}
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 }
}
}