forked from hmcts/idam-web-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
235 lines (196 loc) · 8.42 KB
/
build.gradle
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import java.util.stream.Collectors
plugins {
id 'java'
id 'jacoco'
id 'io.spring.dependency-management' version '1.0.9.RELEASE' apply false
id 'org.owasp.dependencycheck' version '5.1.1'
id 'org.sonarqube' version '2.6.2'
id 'org.springframework.boot' version '2.2.8.RELEASE' apply false
id 'com.gorylenko.gradle-git-properties' version '1.4.21'
id "info.solidsoft.pitest" version "1.5.1"
id 'pmd'
}
gitProperties {
// Change date format in git.properties file.
dateFormat = "yyyy-MM-dd HH:mm:ssZ"
}
allprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'pmd'
group = 'uk.gov.hmcts.reform.idam'
description = 'idam-web-public'
sourceCompatibility = 11
targetCompatibility = 11
def idamBomVersion = '2.3.3'
dependencyManagement {
imports {
mavenBom "uk.gov.hmcts.reform.idam:idam-bom:${idamBomVersion}"
}
}
repositories {
mavenCentral()
maven {
url "https://dl.bintray.com/hmcts/hmcts-maven"
}
jcenter()
}
dependencyCheck {
// Specifies if the build should be failed if a CVSS score above a specified level is identified.
// range of 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild') == 'false' ? 11 : 0
suppressionFile = 'dependency-check-suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
dependencies {
implementation group: 'uk.gov.hmcts.reform.idam', name: 'idam-api-spec'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security'
// TODO: remove version once 2.2.2.RELEASE is out
implementation(group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-zuul', version: '2.2.1.RELEASE') {
exclude(module: 'rxnetty-contexts')
exclude(module: 'rxnetty-servo')
exclude(module: 'rxnetty')
}
implementation group: 'org.springframework.security', name: 'spring-security-taglibs'
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
implementation group: 'javax.servlet', name: 'jstl'
implementation group: 'javax.json', name: 'javax.json-api'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind'
implementation group: 'org.apache.httpcomponents', name: 'httpclient'
implementation group: 'org.apache.httpcomponents', name: 'httpcore'
implementation group: 'org.apache.commons', name: 'commons-text'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-jasper'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-web'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-spring-boot-starter'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-logging-logback'
implementation group: 'org.pitest', name: 'pitest', version: '1.3.2'
implementation group: 'org.owasp.encoder', name: 'encoder-jsp', version: '1.2.2'
implementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.3.0'
implementation group: 'org.codehaus.sonar-plugins', name: 'sonar-pitest-plugin', version: '0.5'
implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.0.4'
implementation group: 'uk.gov.hmcts.reform', name: 'health-spring-boot-starter', version: '0.0.4'
// TODO mockito version is not correctly resolved from IdAM BOM. Remove version when this is fixed
testCompileOnly("org.projectlombok:lombok")
testAnnotationProcessor("org.projectlombok:lombok")
testImplementation group: 'org.mockito', name: 'mockito-core'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-devtools'
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude(module: 'commons-logging')
}
testImplementation group: 'org.springframework.security', name: 'spring-security-test'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
bootRun {
systemProperties = System.properties
}
task smoke(dependsOn: ':codeceptSmoke') {
group = 'Delivery pipeline'
description = 'Executes non-destructive smoke tests against a running instance'
}
task functional(dependsOn: [':codeceptFunctional', ':pa11y']) {
group = 'Delivery pipeline'
description = 'Executes functional tests against a running instance'
}
task yarnInstall(type: Exec) {
workingDir '.'
commandLine 'yarn', 'install'
}
task pa11yInstall(type: Exec) {
workingDir '.'
commandLine 'npm', 'install', 'pa11y'
}
task notifyClientInstall(type: Exec) {
workingDir '.'
commandLine 'npm', 'install', 'notifications-node-client'
}
task codeceptSmoke(type: Exec, dependsOn: ':yarnInstall') {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run', '--grep', '@smoke', '--verbose', '--reporter', 'mocha-multi'
}
task codeceptFunctional(type: Exec, dependsOn: [':yarnInstall', ':notifyClientInstall']) {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run', '--grep', '@functional', '--verbose', '--reporter', 'mocha-multi'
}
task smokeSauce(dependsOn: ':codeceptSmokeSauce') {
group = 'Delivery pipeline'
description = 'Executes non-destructive smoke tests against a running instance'
}
task codeceptSmokeSauce(type: Exec, dependsOn: ':yarnInstall') {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run', '--config', 'saucelabs.conf.js', '--steps', '--grep', '@smoke', '--verbose', '--debug', '--reporter', 'mochawesome'
}
task functionalSauce(dependsOn: ':codeceptFunctionalSauce') {
group = 'Delivery pipeline'
description = 'Executes non-destructive smoke tests against a running instance'
}
task codeceptFunctionalSauce(type: Exec, dependsOn: [':yarnInstall', ':notifyClientInstall']) {
workingDir '.'
commandLine 'node_modules/codeceptjs/bin/codecept.js', 'run-multiple', '--all', '--config', 'saucelabs.conf.js', '--grep', '@crossbrowser', '--verbose', '--debug', '--reporter', 'mochawesome'
}
task pa11y(type: Exec, dependsOn: 'pa11yInstall') {
workingDir '.'
commandLine './node_modules/.bin/pa11y', '--config', 'pa11y.conf.js', System.getenv('TEST_URL')
}
}
project.tasks['sonarqube'].dependsOn test
def listFiles(String pattern) {
return new FileNameFinder()
.getFileNames("${project.rootDir}", pattern)
.stream()
.collect(Collectors.joining(","))
}
sonarqube {
properties {
property "sonar.projectName", "SIDAM-WEB-PUBLIC"
property "sonar.exclusions", "**/uk/gov/hmcts/reform/idam/web/config/properties/*.java," +
"**/uk/gov/hmcts/reform/idam/web/model/*.java," +
"**/uk/gov/hmcts/reform/idam/web/helper/MvcKeys.java," +
"**/uk/gov/hmcts/reform/idam/web/Application.java," +
"**/*Exception.java"
property "sonar.host.url", "https://sonar.reform.hmcts.net/"
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.destination.path}"
}
}
pmd {
toolVersion = "5.8.1"
ignoreFailures = true
sourceSets = [sourceSets.main]
ruleSetFiles = files("$project.rootDir/rules-pmd.xml")
reportsDir = file("$project.buildDir/reports/pmd")
}
pitest {
targetClasses = ['uk.gov.hmcts.reform.idam.*']
threads = 10
enableDefaultIncrementalAnalysis = true
historyInputLocation = 'build/reports/pitest/fastermutationtesting'
historyOutputLocation = 'build/reports/pitest/fastermutationtestingoutput'
outputFormats = ['XML', 'HTML']
timestampedReports = true
mutationThreshold = 80
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
html.destination = file("${buildDir}/reports/jacoco")
}
}
test.finalizedBy jacocoTestReport
bootRun {
systemProperties = System.properties
}