forked from hyrise/hyrise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
234 lines (224 loc) · 12.9 KB
/
Jenkinsfile
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
node {
stage ("Start") {
// Check if the user who opened the PR is a known collaborator (i.e., has been added to a hyrise/hyrise team)
if (env.CHANGE_ID) {
try {
withCredentials([usernamePassword(credentialsId: '5fe8ede9-bbdb-4803-a307-6924d4b4d9b5', usernameVariable: 'GITHUB_USERNAME', passwordVariable: 'GITHUB_TOKEN')]) {
env.PR_CREATED_BY = pullRequest.createdBy
sh '''
curl -s -I -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/hyrise/hyrise/collaborators/${PR_CREATED_BY} | head -n 1 | grep "HTTP/1.1 204 No Content"
'''
}
} catch (error) {
stage ("User unknown") {
script {
githubNotify context: 'CI Pipeline', status: 'FAILURE', description: 'User is not a collaborator'
}
}
throw error
}
}
script {
githubNotify context: 'CI Pipeline', status: 'PENDING'
// Cancel previous builds
if (env.BRANCH_NAME != 'master') {
def jobname = env.JOB_NAME
def buildnum = env.BUILD_NUMBER.toInteger()
def job = Jenkins.instance.getItemByFullName(jobname)
for (build in job.builds) {
if (!build.isBuilding()) { continue; }
if (buildnum == build.getNumber().toInteger()) { continue; }
echo "Cancelling previous build " + build.getNumber().toString()
build.doStop();
}
}
}
}
def oppossumCI = docker.image('hyrise/opossum-ci:18.04');
oppossumCI.pull()
// create ccache volume on host using:
// mkdir /mnt/ccache; mount -t tmpfs -o size=50G none /mnt/ccache
// or add it to /etc/fstab:
// tmpfs /mnt/ccache tmpfs defaults,size=51201M 0 0
oppossumCI.inside("-u 0:0 -v /mnt/ccache:/ccache -e \"CCACHE_DIR=/ccache\" -e \"CCACHE_CPP2=yes\" -e \"CCACHE_MAXSIZE=50GB\" -e \"CCACHE_SLOPPINESS=file_macro\" --privileged=true") {
try {
stage("Setup") {
checkout scm
sh "./install.sh"
sh "mkdir clang-debug && cd clang-debug && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 .. &\
mkdir clang-debug-tidy && cd clang-debug-tidy && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DENABLE_CLANG_TIDY=ON .. &\
mkdir clang-debug-addr-ub-sanitizers && cd clang-debug-addr-ub-sanitizers && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DENABLE_ADDR_UB_SANITIZATION=ON .. &\
mkdir clang-release-addr-ub-sanitizers && cd clang-release-addr-ub-sanitizers && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DENABLE_ADDR_UB_SANITIZATION=ON .. &\
mkdir clang-release && cd clang-release && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 .. &\
mkdir clang-release-addr-ub-sanitizers-no-numa && cd clang-release-addr-ub-sanitizers-no-numa && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DENABLE_ADDR_UB_SANITIZATION=ON -DENABLE_NUMA_SUPPORT=OFF .. &\
mkdir clang-release-thread-sanitizer-no-numa && cd clang-release-thread-sanitizer-no-numa && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DENABLE_THREAD_SANITIZATION=ON -DENABLE_NUMA_SUPPORT=OFF .. &\
mkdir gcc-debug && cd gcc-debug && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. &\
mkdir gcc-release && cd gcc-release && cmake -DCI_BUILD=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. &\
wait"
full_ci = env.BRANCH_NAME == 'master' || pullRequest.labels.contains('FullCI')
}
parallel clangDebug: {
stage("clang-debug") {
sh "export CCACHE_BASEDIR=`pwd`; cd clang-debug && make all -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "./clang-debug/hyriseTest clang-debug"
}
}, gccDebug: {
stage("gcc-debug") {
sh "export CCACHE_BASEDIR=`pwd`; cd gcc-debug && make all -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "./gcc-debug/hyriseTest gcc-debug"
}
}, lint: {
stage("Linting") {
sh '''
scripts/lint.sh
'''
}
}
parallel clangRelease: {
stage("clang-release") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "export CCACHE_BASEDIR=`pwd`; cd clang-release && make all -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "./clang-release/hyriseTest clang-release"
sh "./clang-release/hyriseSystemTest clang-release"
} else {
Utils.markStageSkippedForConditional("clangRelease")
}
}
}, debugSystemTests: {
stage("system-tests") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "mkdir clang-debug-system && ./clang-debug/hyriseSystemTest clang-debug-system"
sh "mkdir gcc-debug-system && ./gcc-debug/hyriseSystemTest gcc-debug-system"
} else {
Utils.markStageSkippedForConditional("debugSystemTests")
}
}
}, clangDebugRunShuffled: {
stage("clang-debug:test-shuffle") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "mkdir ./clang-debug/run-shuffled"
sh "./clang-debug/hyriseTest clang-debug/run-shuffled --gtest_repeat=5 --gtest_shuffle"
sh "./clang-debug/hyriseSystemTest clang-debug/run-shuffled --gtest_repeat=2 --gtest_shuffle"
} else {
Utils.markStageSkippedForConditional("clangDebugRunShuffled")
}
}
}, clangDebugTidy: {
stage("clang-debug:tidy") {
if (env.BRANCH_NAME == 'master' || full_ci) {
// We do not run tidy checks on the src/test folder, so there is no point in running the expensive clang-tidy for those files
sh "export CCACHE_BASEDIR=`pwd`; cd clang-debug-tidy && make hyrise hyriseBenchmarkFileBased hyriseBenchmarkTPCH hyriseConsole hyriseServer -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
} else {
Utils.markStageSkippedForConditional("clangDebugTidy")
}
}
}, clangDebugAddrUBSanitizers: {
stage("clang-debug:addr-ub-sanitizers") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "export CCACHE_BASEDIR=`pwd`; cd clang-debug-addr-ub-sanitizers && make hyriseTest hyriseSystemTest -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "LSAN_OPTIONS=suppressions=resources/.lsan-ignore.txt ASAN_OPTIONS=suppressions=resources/.asan-ignore.txt ./clang-debug-addr-ub-sanitizers/hyriseTest clang-debug-addr-ub-sanitizers"
sh "LSAN_OPTIONS=suppressions=resources/.lsan-ignore.txt ASAN_OPTIONS=suppressions=resources/.asan-ignore.txt ./clang-debug-addr-ub-sanitizers/hyriseSystemTest clang-debug-addr-ub-sanitizers"
} else {
Utils.markStageSkippedForConditional("clangDebugAddrUBSanitizers")
}
}
}, gccRelease: {
if (env.BRANCH_NAME == 'master' || full_ci) {
stage("gcc-release") {
sh "export CCACHE_BASEDIR=`pwd`; cd gcc-release && make all -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "./gcc-release/hyriseTest gcc-release"
sh "./gcc-release/hyriseSystemTest gcc-release"
}
} else {
Utils.markStageSkippedForConditional("gccRelease")
}
}, clangReleaseAddrUBSanitizers: {
stage("clang-release:addr-ub-sanitizers") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "export CCACHE_BASEDIR=`pwd`; cd clang-release-addr-ub-sanitizers && make hyriseTest hyriseSystemTest -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "LSAN_OPTIONS=suppressions=resources/.lsan-ignore.txt ASAN_OPTIONS=suppressions=resources/.asan-ignore.txt ./clang-release-addr-ub-sanitizers/hyriseTest clang-release-addr-ub-sanitizers"
sh "LSAN_OPTIONS=suppressions=resources/.lsan-ignore.txt ASAN_OPTIONS=suppressions=resources/.asan-ignore.txt ./clang-release-addr-ub-sanitizers/hyriseSystemTest clang-release-addr-ub-sanitizers"
} else {
Utils.markStageSkippedForConditional("clangReleaseAddrUBSanitizers")
}
}
}, clangReleaseAddrUBSanitizersNoNuma: {
stage("clang-release:addr-ub-sanitizers w/o NUMA") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "export CCACHE_BASEDIR=`pwd`; cd clang-release-addr-ub-sanitizers-no-numa && make hyriseTest hyriseSystemTest -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "LSAN_OPTIONS=suppressions=resources/.lsan-ignore.txt ASAN_OPTIONS=suppressions=resources/.asan-ignore.txt ./clang-release-addr-ub-sanitizers-no-numa/hyriseTest clang-release-addr-ub-sanitizers-no-numa"
sh "LSAN_OPTIONS=suppressions=resources/.lsan-ignore.txt ASAN_OPTIONS=suppressions=resources/.asan-ignore.txt ./clang-release-addr-ub-sanitizers-no-numa/hyriseSystemTest clang-release-addr-ub-sanitizers-no-numa"
} else {
Utils.markStageSkippedForConditional("clangReleaseAddrUBSanitizersNoNuma")
}
}
}, clangReleaseThreadSanitizerNoNuma: {
stage("clang-release:thread-sanitizer w/o NUMA") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "export CCACHE_BASEDIR=`pwd`; cd clang-release-thread-sanitizer-no-numa && make hyriseTest hyriseSystemTest -j \$(( \$(cat /proc/cpuinfo | grep processor | wc -l) / 3))"
sh "TSAN_OPTIONS=suppressions=resources/.tsan-ignore.txt ./clang-release-thread-sanitizer-no-numa/hyriseTest clang-release-thread-sanitizer-no-numa"
sh "TSAN_OPTIONS=suppressions=resources/.tsan-ignore.txt ./clang-release-thread-sanitizer-no-numa/hyriseSystemTest clang-release-thread-sanitizer-no-numa"
} else {
Utils.markStageSkippedForConditional("clangReleaseThreadSanitizerNoNuma")
}
}
}, clangDebugCoverage: {
stage("clang-debug-coverage") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "export CCACHE_BASEDIR=`pwd`; ./scripts/coverage.sh --generate_badge=true --launcher=ccache"
sh "find coverage -type d -exec chmod +rx {} \\;"
archive 'coverage_badge.svg'
archive 'coverage_percent.txt'
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'coverage',
reportFiles: 'index.html',
reportName: "Llvm-cov_Report"
])
script {
coverageChange = sh script: "./scripts/compare_coverage.sh", returnStdout: true
githubNotify context: 'Coverage', description: "$coverageChange", status: 'SUCCESS', targetUrl: "${env.BUILD_URL}/RCov_20Report/index.html"
}
} else {
Utils.markStageSkippedForConditional("clangDebugCoverage")
}
}
}
stage("memcheckReleaseTest") {
if (env.BRANCH_NAME == 'master' || full_ci) {
sh "mkdir ./clang-release-memcheck-test"
// If this shows a leak, try --leak-check=full, which is slower but more precise
sh "valgrind --tool=memcheck --error-exitcode=1 --gen-suppressions=all --num-callers=25 --suppressions=resources/.valgrind-ignore.txt ./clang-release/hyriseTest clang-release-memcheck-test --gtest_filter=-NUMAMemoryResourceTest.BasicAllocate"
} else {
Utils.markStageSkippedForConditional("memcheckReleaseTest")
}
}
stage("Cleanup") {
// Clean up workspace.
script {
githubNotify context: 'CI Pipeline', status: 'SUCCESS'
if (env.BRANCH_NAME == 'master' || full_ci) {
githubNotify context: 'Full CI', status: 'SUCCESS'
}
}
step([$class: 'WsCleanup'])
}
} catch (error) {
stage ("Cleanup after fail") {
script {
githubNotify context: 'CI Pipeline', status: 'FAILURE'
if (env.BRANCH_NAME == 'master') {
slackSend ":rotating_light: ALARM! Build on Master failed! - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>) :rotating_light:"
}
}
}
throw error
} finally {
sh "ls -A1 | xargs rm -rf"
deleteDir()
}
}
}