-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile-test
More file actions
115 lines (110 loc) · 4.57 KB
/
Copy pathJenkinsfile-test
File metadata and controls
115 lines (110 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
This is the CI script for test builds of Qt for Binary Ninja.
Test builds come from test_* branches.
*/
def jobFormatted = "`<${JOB_URL}|${JOB_NAME}> <${BUILD_URL}|#${BUILD_NUMBER}>`"
def slackResponse = slackSend(message: "Thread for ${jobFormatted}")
pipeline {
agent {
label "master"
}
options {
// Allow downstream jobs to copy artifacts
copyArtifactPermission("*")
// Limit to 1 build per branch at a time
disableConcurrentBuilds()
throttleJobProperty(
categories: ["Qt Build"],
throttleEnabled: true,
throttleOption: "category"
)
// Skip remaining stages if any tests fail
skipStagesAfterUnstable()
// Fail the build if it takes longer than this, since it's likely hung
timeout(time: 60, unit: "MINUTES")
}
environment {
YUBIKEY_PIN = credentials('yubikey-signing-pin')
PYTHONUNBUFFERED = "1"
}
stages {
stage("Build Artifacts") {
matrix {
axes {
axis {
name "os"
values "linux", "linux-arm", "macosx", "win64"
}
}
agent {
node {
label "${os}"
customWorkspace "qtbuild"
}
}
stages {
stage("Build") {
steps {
copyArtifacts(
projectName: "LLVM/llvm-main-pipeline",
selector: lastSuccessful(),
filter: "artifacts/libclang_${os}_*.zip",
target: "artifacts-extern"
)
script {
withEnv(["MISE_TRUSTED_CONFIG_PATHS=${env.WORKSPACE}"]) {
if (isUnix()) {
sh "mise build -- --universal --no-prompt --no-install --sign"
} else {
bat "mise build -- --universal --no-prompt --no-install --sign"
}
}
archiveArtifacts "artifacts/**"
}
}
}
}
}
}
}
post {
always {
script {
def buildVersion = getBuildVersionFromLog()
if (buildVersion) {
addShortText text: buildVersion, border: 0
summary = createSummary icon: "icon-document icon-md"
summary.appendText("Qt Build: " + buildVersion)
}
}
slackSend(channel: slackResponse.threadId, message: "Build finished")
script {
def status = currentBuild.currentResult ?: "UNKNOWN"
def statusMap = [
SUCCESS: [label: "Build succeeded", emoji: ":white_check_mark:", color: "good"],
UNSTABLE: [label: "Build unstable", emoji: ":warning:", color: "warning"],
ABORTED: [label: "Build aborted", emoji: ":heavy_multiplication_x:", color: "warning"],
FAILURE: [label: "Build failed", emoji: ":x:", color: "danger"]
]
def info = statusMap.get(status, [label: "Build ${status.toLowerCase()}", emoji: ":grey_question:", color: "warning"])
slackSend(channel: slackResponse.threadId, message: info.label, color: info.color)
slackSend(channel: slackResponse.channelId, timestamp: slackResponse.ts, message: "${info.emoji} ${info.label}: ${jobFormatted}", color: info.color)
}
}
regression {
script {
// Tag user and post to channel on regression
def committerEmail = sh(
script: "git --no-pager show -s --format='%ae'",
returnStdout: true
).trim()
def userId = slackUserIdFromEmail(committerEmail)
def userPart = "User That Didn't Commit With The Correct Email Address"
if (userId != null) {
userPart = "<@$userId>"
}
slackSend(channel: slackResponse.threadId, message: "Way to go, ${userPart}. You broke the build! :notlikethis:", replyBroadcast: true)
}
}
}
}