2023-08-08 12:06:06 +00:00
|
|
|
#!/usr/bin/env groovy
|
2024-08-26 13:42:29 +00:00
|
|
|
library 'status-jenkins-lib@v1.9.7'
|
2020-08-28 11:55:48 +00:00
|
|
|
|
2022-09-21 10:06:45 +00:00
|
|
|
/* Options section can't access functions in objects. */
|
|
|
|
def isPRBuild = utils.isPRBuild()
|
|
|
|
|
2020-08-28 11:55:48 +00:00
|
|
|
pipeline {
|
2024-05-30 11:38:31 +00:00
|
|
|
agent { label 'windows && x86_64 && qt-5.15.2 && go-1.21' }
|
2020-08-28 11:55:48 +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
|
|
|
|
)
|
2024-08-27 14:34:42 +00:00
|
|
|
choice(
|
|
|
|
name: 'WINDOWS_CODESIGN_TIMESTAMP_URL',
|
|
|
|
description: 'Time Stamp Authority (TSA) server for signing binaries.',
|
|
|
|
choices: [
|
|
|
|
'http://timestamp.apple.com/ts01',
|
2024-08-29 19:10:57 +00:00
|
|
|
'http://timestamp.digicert.com', /* Known to cause 0x80096005, 0x800700e1 errors. */
|
|
|
|
'http://timestamp.sectigo.com?td=sha256',
|
2024-08-27 14:34:42 +00:00
|
|
|
'http://time.certum.pl',
|
|
|
|
'https://freetsa.org',
|
|
|
|
]
|
|
|
|
)
|
2021-04-19 14:45:46 +00:00
|
|
|
}
|
|
|
|
|
2020-08-28 11:55:48 +00:00
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2022-11-15 15:36:03 +00:00
|
|
|
timeout(time: 60, unit: 'MINUTES')
|
2020-08-28 11:55:48 +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-08-28 11:55:48 +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-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2024-03-27 12:23:31 +00:00
|
|
|
PLATFORM = "windows/${getArch()}"
|
2020-08-28 11:55:48 +00:00
|
|
|
/* Improve make performance */
|
2022-07-18 18:17:48 +00:00
|
|
|
MAKEFLAGS = "-j${utils.getProcCount()} V=${params.VERBOSE}"
|
2023-04-07 16:07:37 +00:00
|
|
|
/* Explicitly set the QT version */
|
|
|
|
QTDIR = "/c/Qt/5.15.2/msvc2019_64"
|
2024-10-08 14:06:20 +00:00
|
|
|
PATH = "${env.QTDIR}/bin:${goPath()}/bin:${env.PATH}"
|
2023-06-12 09:21:21 +00:00
|
|
|
/* Avoid weird bugs caused by stale cache. */
|
|
|
|
QML_DISABLE_DISK_CACHE = "true"
|
2020-08-28 11:55:48 +00:00
|
|
|
/* Control output the filename */
|
2023-04-06 09:44:38 +00:00
|
|
|
STATUS_CLIENT_EXE = "pkg/${utils.pkgFilename(ext: 'exe', arch: getArch())}"
|
2021-09-15 07:44:36 +00:00
|
|
|
/* 7zip archive filename */
|
2023-04-06 09:44:38 +00:00
|
|
|
STATUS_CLIENT_7Z = "pkg/${utils.pkgFilename(ext: '7z', arch: getArch())}"
|
2024-08-27 14:34:42 +00:00
|
|
|
/* Hack-fix for params not being set in env on first job run. */
|
|
|
|
WINDOWS_CODESIGN_TIMESTAMP_URL = "${params.WINDOWS_CODESIGN_TIMESTAMP_URL}"
|
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"
|
2020-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2020-09-28 19:24:21 +00:00
|
|
|
stage('Deps') {
|
2020-08-28 11:55:48 +00:00
|
|
|
steps {
|
2022-11-14 19:13:18 +00:00
|
|
|
sh 'make update'
|
2022-04-15 09:17:19 +00:00
|
|
|
sh 'make deps'
|
2020-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('status-go') {
|
2022-07-18 18:17:48 +00:00
|
|
|
steps {
|
|
|
|
sh 'make status-go'
|
|
|
|
}
|
2020-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Package') {
|
2021-04-19 14:45:46 +00:00
|
|
|
steps { script {
|
2021-09-16 13:21:55 +00:00
|
|
|
windows.bundle("${env.STATUS_CLIENT_EXE} ${env.STATUS_CLIENT_7Z}")
|
2021-04-19 14:45:46 +00:00
|
|
|
} }
|
2020-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Parallel Upload') {
|
2022-07-18 18:17:48 +00:00
|
|
|
/* Uploads on Windows are slow. */
|
2020-08-28 11:55:48 +00:00
|
|
|
parallel {
|
2022-07-18 18:17:48 +00:00
|
|
|
stage('Upload 7Z') {
|
2020-08-28 11:55:48 +00:00
|
|
|
steps { script {
|
2021-09-15 07:44:36 +00:00
|
|
|
zip_url = s3.uploadArtifact(env.STATUS_CLIENT_7Z)
|
2020-08-28 11:55:48 +00:00
|
|
|
} }
|
|
|
|
}
|
2022-07-18 18:17:48 +00:00
|
|
|
stage('Upload EXE') {
|
2020-08-28 11:55:48 +00:00
|
|
|
steps { script {
|
2022-07-18 18:17:48 +00:00
|
|
|
exe_url = s3.uploadArtifact(env.STATUS_CLIENT_EXE)
|
2020-08-28 11:55:48 +00:00
|
|
|
} }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-18 18:17:48 +00:00
|
|
|
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
|
|
|
archiveArtifacts(env.STATUS_CLIENT_EXE)
|
|
|
|
archiveArtifacts(env.STATUS_CLIENT_7Z)
|
|
|
|
env.PKG_URL = exe_url
|
|
|
|
jenkins.setBuildDesc(Zip: zip_url, Exe: exe_url)
|
|
|
|
} }
|
|
|
|
}
|
2020-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
2024-04-16 16:33:28 +00:00
|
|
|
// Windows workspace often becomes broken if stoped during checkout.
|
|
|
|
// Post cleanup will fail too.
|
|
|
|
// Use 'Wipe out repository and force clone' manual UI option to prevent it.
|
2024-03-08 16:59:47 +00:00
|
|
|
cleanup { cleanWs() }
|
2020-08-28 11:55:48 +00:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 09:44:38 +00:00
|
|
|
|
|
|
|
def getArch() {
|
|
|
|
def tokens = Thread.currentThread().getName().split('/')
|
|
|
|
for (def arch in ['x86_64', 'aarch64']) {
|
|
|
|
if (tokens.contains(arch)) { return arch }
|
|
|
|
}
|
|
|
|
}
|
2024-10-08 14:06:20 +00:00
|
|
|
|
|
|
|
def goPath() {
|
|
|
|
return sh(script: 'go env GOPATH', returnStdout: true).trim().replace('C:', '/c')
|
|
|
|
}
|