-
Notifications
You must be signed in to change notification settings - Fork 88
/
jenkinsfile
110 lines (98 loc) · 3.56 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
node {
stage("Clone the project - GitHub") {
git 'https://github.com/abhisheksr01/spring-boot-microservice-best-practices.git'
}
stage("Static Code Analysis - Checkstyle") {
sh "./gradlew clean check"
publishHTML target: [
allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : 'build/reports/checkstyle',
reportFiles : 'main.html',
reportName : 'CheckStyle - Main Class Report'
]
publishHTML target: [
allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : 'build/reports/checkstyle',
reportFiles : 'test.html',
reportName : 'CheckStyle - Test Class Report'
]
}
stage("Build - Gradle") {
sh "./gradlew clean build -x test -x checkstyleTest"
}
stage("Unit tests - Junit") {
try {
sh "./gradlew test -Pexcludee2e=**/true*\n"
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/tests/test',
reportFiles: 'index.html',
reportName: 'Unit Test Report'
]
} catch (err) {
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
throw err
}
}
stage("Code Coverage - Jacoco") {
sh "./gradlew jacocoTestReport"
sh "./gradlew jacocoTestCoverageVerification"
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/jacocoHtml',
reportFiles: 'index.html',
reportName: 'Jacoco Coverage Report'
]
}
stage("BDD - Cucumber") {
sh "./gradlew test --tests com.uk.companieshouse.e2e"
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/cucumber',
reportFiles: 'cucumber-report.html',
reportName: 'Cucumber BDD Report'
]
}
stage("Mutation Testing - Pitest") {
try {
sh "./gradlew pitest"
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/cucumber',
reportFiles: 'index.html',
reportName: 'Mutation Testing Report'
]
} catch (err) {
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
throw err
}
}
stage("Dependency Vulnerability Check") {
try {
sh "./gradlew dependencyCheckAnalyze"
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'build/reports/dependency-vulnerabilities',
reportFiles: 'dependency-check-report.html',
reportName: 'Dependency Vulnerability Check Report'
]
} catch (err) {
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
throw err
}
}
}