1
1
node {
2
2
stage("Clone the project - GitHub") {
3
- git 'https://github.com/abhisheksr01/companies-house -microservice-template .git'
3
+ git 'https://github.com/abhisheksr01/spring-boot -microservice-best-practices .git'
4
4
}
5
5
6
6
stage("Static Code Analysis - Checkstyle") {
7
7
sh "./gradlew clean check"
8
8
publishHTML target: [
9
- allowMissing : false,
10
- alwaysLinkToLastBuild: false,
11
- keepAll : true,
12
- reportDir : 'build/reports/checkstyle',
13
- reportFiles : 'main.html',
14
- reportName : 'CheckStyle - Main Class Report'
9
+ allowMissing : false,
10
+ alwaysLinkToLastBuild: false,
11
+ keepAll : true,
12
+ reportDir : 'build/reports/checkstyle',
13
+ reportFiles : 'main.html',
14
+ reportName : 'CheckStyle - Main Class Report'
15
15
]
16
16
publishHTML target: [
17
- allowMissing : false,
18
- alwaysLinkToLastBuild: false,
19
- keepAll : true,
20
- reportDir : 'build/reports/checkstyle',
21
- reportFiles : 'test.html',
22
- reportName : 'CheckStyle - Test Class Report'
17
+ allowMissing : false,
18
+ alwaysLinkToLastBuild: false,
19
+ keepAll : true,
20
+ reportDir : 'build/reports/checkstyle',
21
+ reportFiles : 'test.html',
22
+ reportName : 'CheckStyle - Test Class Report'
23
23
]
24
24
}
25
25
@@ -32,16 +32,15 @@ node {
32
32
sh "./gradlew test -Pexcludee2e=**/true*\n"
33
33
34
34
publishHTML target: [
35
- allowMissing : false,
36
- alwaysLinkToLastBuild: false,
37
- keepAll : true,
38
- reportDir : 'build/reports/tests/test',
39
- reportFiles : 'index.html',
40
- reportName : 'Unit Test Report'
35
+ allowMissing: false,
36
+ alwaysLinkToLastBuild: false,
37
+ keepAll: true,
38
+ reportDir: 'build/reports/tests/test',
39
+ reportFiles: 'index.html',
40
+ reportName: 'Unit Test Report'
41
41
]
42
42
} catch (err) {
43
- step([$class: 'JUnitResultArchiver', testResults:
44
- '**/target/surefire-reports/TEST-*UnitTest.xml'])
43
+ step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
45
44
throw err
46
45
}
47
46
}
@@ -51,35 +50,61 @@ node {
51
50
sh "./gradlew jacocoTestCoverageVerification"
52
51
53
52
publishHTML target: [
54
- allowMissing : false,
55
- alwaysLinkToLastBuild: false,
56
- keepAll : true,
57
- reportDir : 'build/reports/jacocoHtml',
58
- reportFiles : 'index.html',
59
- reportName : 'Jacoco Coverage Report'
53
+ allowMissing: false,
54
+ alwaysLinkToLastBuild: false,
55
+ keepAll: true,
56
+ reportDir: 'build/reports/jacocoHtml',
57
+ reportFiles: 'index.html',
58
+ reportName: 'Jacoco Coverage Report'
60
59
]
61
60
}
62
61
63
62
stage("BDD - Cucumber") {
64
63
sh "./gradlew test --tests com.uk.companieshouse.e2e"
65
64
66
65
publishHTML target: [
67
- allowMissing : false,
68
- alwaysLinkToLastBuild: false,
69
- keepAll : true,
70
- reportDir : 'build/reports/cucumber',
71
- reportFiles : 'index .html',
72
- reportName : 'Cucumber BDD Report'
66
+ allowMissing: false,
67
+ alwaysLinkToLastBuild: false,
68
+ keepAll: true,
69
+ reportDir: 'build/reports/cucumber',
70
+ reportFiles: 'cucumber-report .html',
71
+ reportName: 'Cucumber BDD Report'
73
72
]
74
73
}
75
74
76
75
stage("Mutation Testing - Pitest") {
77
76
try {
78
77
sh "./gradlew pitest"
78
+
79
+ publishHTML target: [
80
+ allowMissing: false,
81
+ alwaysLinkToLastBuild: false,
82
+ keepAll: true,
83
+ reportDir: 'build/reports/cucumber',
84
+ reportFiles: 'index.html',
85
+ reportName: 'Mutation Testing Report'
86
+ ]
87
+ } catch (err) {
88
+ step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
89
+ throw err
90
+ }
91
+ }
92
+
93
+ stage("Dependency Vulnerability Check") {
94
+ try {
95
+ sh "./gradlew dependencyCheckAnalyze"
96
+
97
+ publishHTML target: [
98
+ allowMissing: false,
99
+ alwaysLinkToLastBuild: false,
100
+ keepAll: true,
101
+ reportDir: 'build/reports/dependency-vulnerabilities',
102
+ reportFiles: 'dependency-check-report.html',
103
+ reportName: 'Dependency Vulnerability Check Report'
104
+ ]
79
105
} catch (err) {
80
- step([$class: 'JUnitResultArchiver', testResults:
81
- '**/target/surefire-reports/TEST-*UnitTest.xml'])
106
+ step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
82
107
throw err
83
108
}
84
109
}
85
- }
110
+ }
0 commit comments