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>
208 lines
6.4 KiB
Groovy
208 lines
6.4 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()
|
|
|
|
pipeline {
|
|
|
|
agent { label "macos && arm64 && nix-2.24 && xcode-26.4 && qt-${QT_VERSION}" }
|
|
|
|
parameters {
|
|
booleanParam(
|
|
name: 'RELEASE',
|
|
description: 'Decides whether release credentials are used.',
|
|
defaultValue: params.RELEASE ?: false
|
|
)
|
|
choice(
|
|
name: 'VERBOSE',
|
|
description: 'Level of verbosity based on nimbus-build-system setup.',
|
|
choices: ['0','1','2','3']
|
|
)
|
|
string(
|
|
name: 'TESTFLIGHT_POLL_TIMEOUT',
|
|
description: 'TestFlight build polling timeout in minutes.',
|
|
defaultValue: '30'
|
|
)
|
|
string(
|
|
name: 'TESTFLIGHT_POLL_INTERVAL',
|
|
description: 'TestFlight build polling interval in seconds.',
|
|
defaultValue: '30'
|
|
)
|
|
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: 45, 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 {
|
|
GOCACHE = "${env.WORKSPACE_TMP}/go-cache"
|
|
GOMODCACHE = "${env.WORKSPACE_TMP}/go-mod-cache"
|
|
GOTMPDIR = "${env.WORKSPACE_TMP}"
|
|
PLATFORM = "ios/${getArch()}"
|
|
/* Improve make performance */
|
|
MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE}"
|
|
QMAKE = "/Users/admin/${QT_VERSION}/ios/bin/qmake"
|
|
QT_HOST_PATH = "/Users/admin/${QT_VERSION}/macos"
|
|
/* QMAKE = sh(script: "which qmake", returnStdout: true).trim() */
|
|
QTDIR = sh(script:"${env.QMAKE} -query QT_INSTALL_PREFIX", returnStdout: true).trim()
|
|
/* Enforce Go version installed infra-role-golang. */
|
|
/* to fix missing rcc, since QT6 rcc is located at ${QTDIR}/libexec/rcc */
|
|
PATH = "${env.QTDIR}/bin:${env.QTDIR}/libexec:${env.HOME}/go/bin:/usr/local/go/bin:${env.PATH}:/run/current-system/sw/bin"
|
|
/* prevent sharing cache dir across different jobs */
|
|
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
|
XDG_CACHE_HOME = "${env.WORKSPACE_TMP}/.cache"
|
|
/* sets App Version in Settings */
|
|
VERSION = "${utils.getVersion()}"
|
|
/* Control output the filename */
|
|
APP_TYPE = "${utils.getAppType()}"
|
|
/* iOS build configuration */
|
|
IPHONE_SDK = "iphoneos"
|
|
ARCH = "arm64"
|
|
STATUS_IOS_APP_ARTIFACT = "pkg/${utils.pkgFilename(ext: 'ipa', arch: getArch(), version: env.VERSION, type: env.APP_TYPE)}"
|
|
TESTFLIGHT_POLL_TIMEOUT = "${params.TESTFLIGHT_POLL_TIMEOUT}"
|
|
TESTFLIGHT_POLL_INTERVAL = "${params.TESTFLIGHT_POLL_INTERVAL}"
|
|
/* Signing is handled by fastlane after build */
|
|
QMAKE_EXTRA_CONFIG = "fastlane"
|
|
/* nim-sds source directory */
|
|
NIM_SDS_SOURCE_DIR = "${env.WORKSPACE_TMP}/nim-sds"
|
|
/* Build variant: used by mobile/scripts/App.sh and mobile/fastlane/Fastfile */
|
|
BUILD_VARIANT = "${utils.isReleaseBuild() ? 'release' : 'pr'}"
|
|
/* Build flags */
|
|
FLAG_BUY_ENABLED = "${utils.isReleaseBuild() ? 0 : 1}"
|
|
FLAG_SWAP_ENABLED = "${utils.isReleaseBuild() ? 0 : 1}"
|
|
FLAG_BRIDGE_ENABLED = "${utils.isReleaseBuild() ? 0 : 1}"
|
|
/* fix for proxy stage defaulting to test */
|
|
STATUS_BUILD_PROXY_STAGE_NAME = "${utils.isReleaseBuild() ? 'prod' : 'test'}"
|
|
}
|
|
|
|
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('status-go') {
|
|
steps {
|
|
sh 'make status-go'
|
|
}
|
|
}
|
|
|
|
stage('Build iOS App') {
|
|
steps {
|
|
script {
|
|
status.buildSigned(platform='ios', target='mobile-build', verbose=params.VERBOSE)
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Package iOS App') {
|
|
steps {
|
|
sh 'mkdir -p pkg'
|
|
sh "cp ${WORKSPACE}/mobile/bin/ios/qt6/Status${utils.isReleaseBuild() ? '' : 'PR'}.ipa ${env.STATUS_IOS_APP_ARTIFACT}"
|
|
sh "ls -lh ${env.STATUS_IOS_APP_ARTIFACT}"
|
|
}
|
|
}
|
|
|
|
stage('Parallel Upload') {
|
|
parallel {
|
|
stage('Upload to TestFlight') {
|
|
when { expression { utils.isReleaseBuild() } }
|
|
steps {
|
|
script {
|
|
def changelog = sh(script: './scripts/generate-changelog.sh', returnStdout: true).trim()
|
|
|
|
status.uploadToTestFlight(
|
|
ipaPath="${WORKSPACE}/${env.STATUS_IOS_APP_ARTIFACT}",
|
|
changelog=changelog,
|
|
pollTimeout=env.TESTFLIGHT_POLL_TIMEOUT,
|
|
pollInterval=env.TESTFLIGHT_POLL_INTERVAL
|
|
)
|
|
}
|
|
}
|
|
}
|
|
stage('Upload to Diawi') {
|
|
when { expression { !utils.isReleaseBuild() } }
|
|
steps {
|
|
script {
|
|
def comment = "status-desktop PR build ${env.VERSION} ${git.commit(8)}"
|
|
env.DIAWI_URL = status.uploadToDiawi(env.STATUS_IOS_APP_ARTIFACT, comment)
|
|
jenkins.setBuildDesc(IPA: env.DIAWI_URL)
|
|
}
|
|
}
|
|
}
|
|
stage('Upload to S3') {
|
|
steps {
|
|
script {
|
|
env.PKG_URL = s5cmd.upload(env.STATUS_IOS_APP_ARTIFACT)
|
|
}
|
|
}
|
|
}
|
|
stage('Archive') {
|
|
steps {
|
|
archiveArtifacts env.STATUS_IOS_APP_ARTIFACT
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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 }
|
|
}
|
|
}
|
|
|
|
/* We extract the name of the job from currentThread because
|
|
* before an agent is picked env is not available. */
|
|
def getJobPathTokens() {
|
|
return Thread.currentThread().getName().split('/')
|
|
}
|