2023-08-08 12:06:06 +00:00
|
|
|
#!/usr/bin/env groovy
|
2024-12-02 10:16:51 +00:00
|
|
|
library 'status-jenkins-lib@v1.9.14'
|
2020-07-06 08:48:42 +00:00
|
|
|
|
2022-09-21 10:06:45 +00:00
|
|
|
/* Options section can't access functions in objects. */
|
|
|
|
def isPRBuild = utils.isPRBuild()
|
|
|
|
|
2020-06-18 16:44:22 +00:00
|
|
|
pipeline {
|
2023-04-06 09:44:38 +00:00
|
|
|
/* This way we run the same Jenkinsfile on different platforms. */
|
2020-06-18 16:44:22 +00:00
|
|
|
agent {
|
2024-05-30 11:38:31 +00:00
|
|
|
label "${getAgentLabels().join(' && ')} && qt-5.15 && go-1.21"
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
|
2021-04-19 14:45:46 +00:00
|
|
|
parameters {
|
2022-02-09 10:52:14 +00:00
|
|
|
booleanParam(
|
|
|
|
name: 'RELEASE',
|
2024-02-23 09:19:57 +00:00
|
|
|
description: 'Decides whether release credentials are used.',
|
2022-02-09 10:52:14 +00:00
|
|
|
defaultValue: params.RELEASE ?: false
|
2021-04-19 14:45:46 +00:00
|
|
|
)
|
2024-02-23 09:19:57 +00:00
|
|
|
booleanParam(
|
|
|
|
name: 'INCLUDE_DEBUG_SYMBOLS',
|
|
|
|
description: 'Decides whether binaries are built with debug symbols.',
|
|
|
|
defaultValue: params.INCLUDE_DEBUG_SYMBOLS ?: false
|
|
|
|
)
|
2022-02-09 10:59:41 +00:00
|
|
|
choice(
|
|
|
|
name: 'VERBOSE',
|
|
|
|
description: 'Level of verbosity based on nimbus-build-system setup.',
|
|
|
|
choices: ['0', '1', '2']
|
|
|
|
)
|
2023-06-06 09:13:32 +00:00
|
|
|
string(
|
|
|
|
name: 'NIMFLAGS',
|
|
|
|
description: 'Extra Nim flags. Examples: --verbosity:2 --passL:"-v" --passC:"-v"',
|
2024-10-09 08:25:37 +00:00
|
|
|
defaultValue: "--colors:off --nimcache:${env.WORKSPACE_TMP}/nimcache"
|
2023-06-06 09:13:32 +00:00
|
|
|
)
|
2023-10-11 16:54:04 +00:00
|
|
|
booleanParam(
|
|
|
|
name: 'USE_MOCKED_KEYCARD_LIB',
|
|
|
|
description: 'Decides whether the mocked status-keycard-go library is built.',
|
|
|
|
defaultValue: false
|
|
|
|
)
|
2023-08-08 10:08:21 +00:00
|
|
|
choice(
|
|
|
|
name: 'ENTITLEMENTS',
|
|
|
|
description: 'Select app entitlements. Squish requires extra entitlements.',
|
|
|
|
choices: ['resources/Entitlements.plist', 'resources/Entitlements_squish.plist']
|
|
|
|
)
|
2021-04-19 14:45:46 +00:00
|
|
|
}
|
|
|
|
|
2020-06-18 16:44:22 +00:00
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2023-04-27 11:01:33 +00:00
|
|
|
timeout(time: 30, unit: 'MINUTES')
|
2020-06-18 16:44:22 +00:00
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
2020-11-24 18:42:31 +00:00
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '30',
|
2024-02-28 14:56:40 +00:00
|
|
|
artifactNumToKeepStr: '1',
|
2020-06-18 16:44:22 +00:00
|
|
|
))
|
2023-04-18 12:22:27 +00:00
|
|
|
/* Allows combined build to copy */
|
|
|
|
copyArtifactPermission('/status-desktop/*')
|
2022-09-21 10:06:45 +00:00
|
|
|
/* Abort old PR builds. */
|
|
|
|
disableConcurrentBuilds(
|
|
|
|
abortPrevious: isPRBuild
|
|
|
|
)
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2024-03-27 12:23:31 +00:00
|
|
|
PLATFORM = "macos/${getArch()}"
|
2020-06-18 16:44:22 +00:00
|
|
|
/* Improve make performance */
|
2022-02-09 10:59:41 +00:00
|
|
|
MAKEFLAGS = "-j4 V=${params.VERBOSE}"
|
2023-04-06 09:44:38 +00:00
|
|
|
/* WARNING: Qt 5.15.8 installed via Brew. */
|
|
|
|
QTDIR = '/opt/homebrew/opt/qt@5'
|
2024-06-07 08:48:42 +00:00
|
|
|
/* Enforce Go version installed infra-role-golang. */
|
2024-10-08 14:06:20 +00:00
|
|
|
PATH = "${env.QTDIR}/bin:${env.HOME}/go/bin:/usr/local/go/bin:${env.PATH}"
|
2023-06-12 09:21:21 +00:00
|
|
|
/* Avoid weird bugs caused by stale cache. */
|
|
|
|
QML_DISABLE_DISK_CACHE = "true"
|
2020-06-18 16:44:22 +00:00
|
|
|
/* Control output the filename */
|
2024-12-04 22:42:48 +00:00
|
|
|
VERSION = sh(script: "./scripts/version.sh", returnStdout: true)
|
|
|
|
STATUS_CLIENT_DMG = "pkg/${utils.pkgFilename(ext: 'dmg', arch: getArch(), version: env.VERSION)}"
|
2021-05-27 07:53:40 +00:00
|
|
|
/* Apple Team ID for Notarization */
|
2022-12-08 19:06:28 +00:00
|
|
|
MACOS_NOTARIZE_TEAM_ID = "8B5X2M6H2Y"
|
2024-10-08 14:06:20 +00:00
|
|
|
/* prevent sharing cache dir across different jobs */
|
|
|
|
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
|
2024-12-02 10:16:51 +00:00
|
|
|
SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}"
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2020-09-28 19:24:21 +00:00
|
|
|
stage('Deps') {
|
2022-12-08 19:06:28 +00:00
|
|
|
steps {
|
2022-11-14 19:13:18 +00:00
|
|
|
sh 'make update'
|
2022-04-15 09:17:19 +00:00
|
|
|
withCredentials([
|
|
|
|
usernamePassword( /* For fetching HomeBrew bottles. */
|
|
|
|
credentialsId: "status-im-auto-pkgs",
|
|
|
|
usernameVariable: 'GITHUB_USER',
|
|
|
|
passwordVariable: 'GITHUB_TOKEN'
|
|
|
|
)
|
|
|
|
]) {
|
|
|
|
sh 'make deps'
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('status-go') {
|
2022-07-18 18:17:48 +00:00
|
|
|
steps {
|
|
|
|
sh 'make status-go'
|
|
|
|
}
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
|
2020-10-30 01:53:34 +00:00
|
|
|
stage('Package') {
|
2021-05-27 07:53:40 +00:00
|
|
|
steps { script {
|
2022-07-18 18:17:48 +00:00
|
|
|
macos.bundle('pkg-macos')
|
2021-05-27 07:53:40 +00:00
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Notarize') {
|
|
|
|
when { expression { utils.isReleaseBuild() } }
|
|
|
|
steps { script {
|
|
|
|
macos.notarize()
|
|
|
|
} }
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
|
2020-07-06 08:48:42 +00:00
|
|
|
stage('Parallel Upload') {
|
|
|
|
parallel {
|
|
|
|
stage('Upload') {
|
|
|
|
steps { script {
|
|
|
|
env.PKG_URL = s3.uploadArtifact(env.STATUS_CLIENT_DMG)
|
2020-09-28 05:55:58 +00:00
|
|
|
jenkins.setBuildDesc(Dmg: env.PKG_URL)
|
2020-07-06 08:48:42 +00:00
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
|
|
|
archiveArtifacts(env.STATUS_CLIENT_DMG)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
}
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
2020-07-06 08:48:42 +00:00
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
2022-11-22 12:40:45 +00:00
|
|
|
cleanup { sh './scripts/clean-git.sh' }
|
2020-06-18 16:44:22 +00:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 09:44:38 +00:00
|
|
|
|
|
|
|
/* This allows us to use one Jenkinsfile and run
|
|
|
|
* jobs on different platforms based on job name. */
|
|
|
|
def getAgentLabels() {
|
|
|
|
if (params.AGENT_LABEL) { return params.AGENT_LABEL }
|
|
|
|
/* We extract the name of the job from currentThread because
|
|
|
|
* before an agent is picket env is not available. */
|
|
|
|
def tokens = Thread.currentThread().getName().split('/')
|
|
|
|
def labels = []
|
|
|
|
/* Check if the job path contains any of the valid labels. */
|
|
|
|
['linux', 'macos', 'x86_64', 'aarch64', 'arm64'].each {
|
|
|
|
if (tokens.contains(it)) { labels.add(it) }
|
|
|
|
}
|
|
|
|
return labels
|
|
|
|
}
|
|
|
|
|
|
|
|
def getArch() {
|
|
|
|
def tokens = Thread.currentThread().getName().split('/')
|
|
|
|
for (def arch in ['x86_64', 'aarch64']) {
|
|
|
|
if (tokens.contains(arch)) { return arch }
|
|
|
|
}
|
|
|
|
}
|