-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
87 lines (81 loc) · 2.93 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
pipeline {
environment {
registry = "thearusable/nocturne"
registryCredential = 'dockerhub'
}
// no default agent - need to be specified per stage
agent none
stages {
//@TODO - Prepare dockerfiles for other operating systems (Windows, Mac)
stage('Docker'){
agent any
steps{
script{
// build docker image from dockerfile
sh 'docker build -t ${registry} .'
// publish image on docker hub
if (env.BRANCH_NAME == "develop"){
docker.withRegistry( '', registryCredential ) {
sh 'docker push ${registry}:latest'
}
} else {
sh 'echo "Not a develop branch - SKIPPING."'
}
}
}
}
stage ('Static analysis') {
agent any
steps {
//cppcheck
sh 'cppcheck --enable=all --inconclusive --verbose --xml --xml-version=2 . 2> cppcheck_report.xml'
publishCppcheck pattern:'cppcheck_report.xml'
//@TODO - add other tools
}
}
stage ('Build engine'){
agent { docker { image 'thearusable/nocturne:latest' } }
steps {
dir('build')
{
sh 'cmake ..'
sh 'make all'
}
}
}
stage ('Testing'){
agent { docker { image 'thearusable/nocturne:latest' } }
steps {
dir('build')
{
sh 'cmake ..'
sh 'make test'
//@TODO - Generate coverage raport
}
}
}
stage ('Documentation'){
agent { docker { image 'thearusable/nocturne:latest' } }
steps {
dir('build')
{
sh 'cmake ..'
sh 'make doc'
//@TODO - Publish doc files to GitHub
}
}
}
}
post {
unsuccessful {
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
fixed {
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
}
}