mirror of
https://github.com/status-im/status-app.git
synced 2026-08-27 07:01:14 +00:00
- 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.
254 lines
8.2 KiB
Groovy
254 lines
8.2 KiB
Groovy
#!/usr/bin/env groovy
|
|
library 'status-jenkins-lib@v1.9.48'
|
|
|
|
QT_VERSION = "6.11.0"
|
|
|
|
STATUSQ_TESTS_BUILD_PATH = "ui/StatusQ/build/ci-tests-Qt${QT_VERSION}"
|
|
|
|
/* Options section can't access functions in objects. */
|
|
def isPRBuild = utils.isPRBuild()
|
|
def isNightlyBuild = utils.isNightlyBuild()
|
|
|
|
pipeline {
|
|
agent {
|
|
/* Image with Ubuntu 22.04, QT ${QT_VERSION} and Xvfb (for the UI tests). */
|
|
docker {
|
|
label 'linuxcontainer'
|
|
image "harbor.status.im/status-im/status-desktop-build:1.0.12-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: ''
|
|
)
|
|
booleanParam(
|
|
name: 'RUN_NIM_TESTS',
|
|
description: 'Run the Nim unit tests and benchmarks alongside the package build.',
|
|
defaultValue: params.RUN_NIM_TESTS != null ? params.RUN_NIM_TESTS : true
|
|
)
|
|
booleanParam(
|
|
name: 'RUN_UI_TESTS',
|
|
description: 'Run QML lint, translation checks, StatusQ and Storybook tests alongside the package build.',
|
|
defaultValue: params.RUN_UI_TESTS != null ? params.RUN_UI_TESTS : true
|
|
)
|
|
}
|
|
|
|
options {
|
|
timestamps()
|
|
/* Prevent Jenkins jobs from running forever. */
|
|
timeout(time: 150, 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} USE_SYSTEM_NIM=1"
|
|
/* 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. Note: per-test nimcache is set in nim-tests.mk */
|
|
NIMFLAGS = "${params.NIMFLAGS} --colors:off"
|
|
}
|
|
|
|
stages {
|
|
stage('Cleanup Workspace') {
|
|
steps {
|
|
sh './scripts/clean-git.sh'
|
|
}
|
|
}
|
|
stage('Fetch submodules') {
|
|
steps {
|
|
sh './scripts/ci-fetch-submodules.sh'
|
|
}
|
|
}
|
|
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('Shared artifacts') {
|
|
steps {
|
|
sh 'make statusq'
|
|
sh 'make qrcodegen'
|
|
}
|
|
}
|
|
|
|
stage('Build') {
|
|
parallel {
|
|
stage('Package') {
|
|
steps { script {
|
|
status.buildSigned(platform='linux', target='tgz-linux')
|
|
env.PKG_URL = s5cmd.upload(env.STATUS_CLIENT_TARBALL)
|
|
jenkins.setBuildDesc(AppImage: env.PKG_URL)
|
|
archiveArtifacts("${env.STATUS_CLIENT_TARBALL}*")
|
|
if (utils.isPRBuild()) {
|
|
build(
|
|
job: 'status-app/e2e/prs',
|
|
wait: false,
|
|
parameters: jenkins.mapToParams([
|
|
GIT_REF: env.CHANGE_BRANCH ?: env.BRANCH_NAME,
|
|
BUILD_SOURCE: env.JOB_NAME,
|
|
]),
|
|
)
|
|
}
|
|
} }
|
|
}
|
|
|
|
stage('Nim Tests') {
|
|
when { expression { params.RUN_NIM_TESTS } }
|
|
steps { script {
|
|
sh 'make tests-nim-linux V=1'
|
|
} }
|
|
}
|
|
|
|
stage('UI Tests') {
|
|
when { expression { params.RUN_UI_TESTS } }
|
|
stages {
|
|
stage('Check Translations') {
|
|
steps { script { checkTranslations() } }
|
|
}
|
|
stage('QML Lint') {
|
|
steps { script {
|
|
sh 'make qml-lint'
|
|
} }
|
|
}
|
|
/* Xvfb is needed for QGuiApplication to import QtQuick.Dialogs. */
|
|
stage('Check StatusQ Tests') {
|
|
steps { script {
|
|
wrap([$class: 'Xvfb', autoDisplayName: true, parallelBuild: true, screen: '2560x1440x24']) {
|
|
sh "make run-statusq-tests STATUSQ_BUILD_PATH=${STATUSQ_TESTS_BUILD_PATH}"
|
|
}
|
|
} }
|
|
}
|
|
stage('Check StatusQ Sanity Checker') {
|
|
steps { script {
|
|
wrap([$class: 'Xvfb', autoDisplayName: true, parallelBuild: true, screen: '2560x1440x24']) {
|
|
sh "make run-statusq-sanity-checker STATUSQ_BUILD_PATH=${STATUSQ_TESTS_BUILD_PATH}"
|
|
}
|
|
} }
|
|
}
|
|
stage('Check Storybook Tests') {
|
|
steps { script {
|
|
wrap([$class: 'Xvfb', autoDisplayName: true, parallelBuild: true, screen: '2560x1440x24']) {
|
|
sh 'make run-storybook-tests'
|
|
}
|
|
} }
|
|
}
|
|
stage('Check Storybook Pages Validator') {
|
|
steps { script {
|
|
wrap([$class: 'Xvfb', autoDisplayName: true, parallelBuild: true, screen: '2560x1440x24']) {
|
|
sh 'make run-storybook-pages-validator'
|
|
}
|
|
} }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success { script { github.notifyPR(true) } }
|
|
failure { script { github.notifyPR(false) } }
|
|
cleanup {
|
|
cleanWs(disableDeferredWipeout: true)
|
|
dir(env.WORKSPACE_TMP) { deleteDir() }
|
|
}
|
|
}
|
|
}
|
|
|
|
def checkTranslations() {
|
|
sh 'make update-translations'
|
|
def changes = sh(script: 'git diff --name-only ui/i18n/*.ts', returnStdout: true).trim()
|
|
if (changes) {
|
|
error("Translation files out of date.\n\nModified files:\n${changes}\n\nTo fix: run 'make update-translations' and commit changes.")
|
|
}
|
|
}
|
|
|
|
def getArch() {
|
|
def tokens = Thread.currentThread().getName().split('/')
|
|
for (def arch in ['x86_64', 'aarch64']) {
|
|
if (tokens.contains(arch)) { return arch }
|
|
}
|
|
}
|