forked from gunrock/gunrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
102 lines (89 loc) · 2.08 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
// 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'
// MGPU not fully supported in v1.0.0
sh '''cd build
cmake -DGUNROCK_CODE_COVERAGE=ON -DGUNROCK_GOOGLE_TESTS=ON .. //-DGUNROCK_MGPU_TESTS=ON ..
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.RUN_DISPLAY_URL}"
slackSend(color: color, message: msg)
}
pipeline {
agent any
stages {
stage('Init') {
steps {
notifySlack('STARTED')
init_git()
}
}
stage('Build') {
steps {
cmake_build()
}
}
stage('Regression Tests') {
steps {
sh '''cd build
cd examples
ctest -VV'''
}
}
stage('Code Coverage') {
steps {
sh '''#!/bin/bash
cd build
CODECOV_TOKEN="d0690e81-c2ed-42d0-8a63-da351c3ae619"
bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN} || echo "Error: Codecov did not collect coverage reports"'''
}
}
stage('Deploy') {
steps {
echo 'Branch: Master.'
echo 'Pipleline finished.'
}
}
}
post {
always {
cleanWs()
}
success {
notifySlack('SUCCESS')
}
failure {
notifySlack('FAILURE')
}
}
}