forked from gunrock/gunrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
92 lines (83 loc) · 1.71 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
// Jenkins pipeline
// See documents at https://jenkins.io/doc/book/pipeline/jenkinsfile/
// initialize source codes
def init_git() {
checkout scm
retry(5) {
timeout(time: 2, unit: 'MINUTES') {
sh 'git submodule update --init'
}
}
}
// build gunrock using cmake
def cmake_build() {
checkout scm
retry(5) {
timeout(time: 20, unit: 'MINUTES') {
sh 'mkdir -p build'
sh '''cd build
cmake ..
make -j16'''
}
}
}
// notify slack of build status and progress
def notifySlack(String buildStatus = 'STARTED') {
// Build status of null means success.
buildStatus = buildStatus ?: 'SUCCESS'
def color
if (buildStatus == 'STARTED') {
color = '#D4DADF'
} else if (buildStatus == 'SUCCESS') {
color = '#BDFFC3'
} else if (buildStatus == 'UNSTABLE') {
color = '#FFFE89'
} else {
color = '#FF9FA1'
}
def msg = "${buildStatus}: `${env.JOB_NAME}` #${env.BUILD_NUMBER}:\n${env.BUILD_URL}"
slackSend(color: color, message: msg)
}
pipeline {
agent any
triggers {
pollSCM '@hourly'
}
stages {
stage('Init') {
steps {
notifySlack('STARTED')
init_git()
}
}
stage('Build') {
steps {
cmake_build()
}
}
stage('Regression Tests') {
steps {
sh '''cd build
ctest -VV'''
}
}
stage('Deploy') {
steps {
echo 'Branch: Master.'
echo 'Pipleline finished.'
}
}
}
post {
always {
cleanWs()
}
success {
// Implement: junit 'build/reports/**/*.xml'
notifySlack('SUCCESS')
}
failure {
notifySlack('FAILURE')
}
}
}