This repository has been archived by the owner on Apr 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
96 lines (85 loc) · 2 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
pipeline {
agent any
options {
ansiColor('xterm')
}
stages {
stage('Setup') {
steps {
sh './setup.sh'
}
}
stage('Luacheck') {
steps {
sh './luacheck.sh'
}
post {
failure {
githubNotify description: 'Luacheck failed', status: 'FAILURE', context: 'luacheck'
}
success {
githubNotify description: 'Luacheck passed.', status: 'SUCCESS', context: 'luacheck'
}
}
}
stage('Code style check') {
steps {
sh './checkFormat.sh'
}
post {
failure {
githubNotify description: 'Code style check failed', status: 'FAILURE', context: 'codestyle'
}
success {
githubNotify description: 'Code style check passed.', status: 'SUCCESS', context: 'codestyle'
}
}
}
stage('Tests') {
steps {
sh 'rm -f testReport.xml cobertura.xml && ./test.sh --verbose --coverage --output junit > testReport.xml && ./lua_install/bin/luacov-cobertura -o cobertura.xml'
}
post {
failure {
githubNotify description: 'Tests failed', status: 'FAILURE', context: 'tests'
}
success {
githubNotify description: 'Tests passed.', status: 'SUCCESS', context: 'tests'
}
}
}
stage('Record Coverage') {
when { branch 'master' }
steps {
script {
currentBuild.result = 'SUCCESS'
}
step([$class: 'MasterCoverageAction', scmVars: [GIT_URL: env.GIT_URL]])
}
}
stage('PR Coverage to Github') {
when { allOf {not { branch 'master' }; expression { return env.CHANGE_ID != null }} }
steps {
script {
currentBuild.result = 'SUCCESS'
}
step([$class: 'CompareCoverageAction', scmVars: [GIT_URL: env.GIT_URL]])
}
}
}
post {
always {
junit "testReport.xml"
cobertura coberturaReportFile: 'cobertura.xml'
}
failure {
githubNotify description: 'Build failed.', status: 'ERROR'
}
unstable {
githubNotify description: 'Status checks failed.', status: 'FAILURE'
}
success {
githubNotify description: 'Status checks passed.', status: 'SUCCESS'
}
}
}