forked from tls-attacker/TLS-Scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
138 lines (134 loc) · 4.21 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
pipeline {
agent any
environment {
JDK_TOOL_NAME = 'JDK 11'
MAVEN_TOOL_NAME = 'Maven 3.8.6'
}
options {
skipStagesAfterUnstable()
disableConcurrentBuilds abortPrevious: true
}
stages {
stage('Clean') {
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn clean'
}
}
}
stage('Format Check') {
options {
timeout(activity: true, time: 60, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn spotless:check'
}
}
}
stage('Build') {
options {
timeout(activity: true, time: 120, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn -DskipTests=true package'
}
}
post {
success {
archiveArtifacts artifacts: '**/target/*.jar'
}
}
}
stage('Code Analysis') {
when {
anyOf {
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 240, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
// `package` goal is required here to load modules in reactor and avoid dependency resolve conflicts
sh 'mvn -DskipTests=true package pmd:pmd pmd:cpd spotbugs:spotbugs'
}
}
post {
always {
recordIssues enabledForFailure: true, tools: [spotBugs(), cpd(pattern: '**/target/cpd.xml'), pmdParser(pattern: '**/target/pmd.xml')]
}
}
}
stage('Unit Tests') {
when {
anyOf {
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 180, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn -P coverage -Dskip.failsafe.tests=true test'
}
}
post {
always {
junit testResults: '**/target/surefire-reports/TEST-*.xml'
}
}
}
stage('Integration Tests') {
when {
anyOf {
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 600, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn -P coverage -Dskip.surefire.tests=true verify'
}
}
post {
always {
junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true
}
success {
publishCoverage adapters: [jacoco(mergeToOneReport: true, path: '**/target/site/jacoco/jacoco.xml')]
}
}
}
stage('Deploy to Internal Nexus Repository') {
when {
anyOf {
branch 'main'
tag 'v*'
}
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
// Tests were already executed separately, so disable tests within this step
sh 'mvn -DskipTests=true deploy'
}
}
}
}
post {
always {
recordIssues enabledForFailure: true, tools: [mavenConsole(), java(), javaDoc()]
}
}
}