forked from SCK-SEAL-TEAM-One/shopping-cart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
126 lines (111 loc) · 2.85 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
pipeline {
agent any
stages {
stage('Install Dependency') {
steps {
sh 'make install_dependency_frontend'
}
}
stage('Code Analysis') {
parallel {
stage('Frontend') {
steps {
sh 'make code_analysis_frontend'
}
}
stage('Backend') {
steps {
script {
def root = tool type: 'go', name: 'Go1.16.4'
withEnv(["GOROOT=${root}", "PATH+GO=${root}/bin"]){
sh 'make code_analysis_backend'
}
}
}
}
}
}
stage('Run Unit Testing') {
parallel {
stage('Frontend') {
steps {
sh 'make run_unittest_frontend'
}
}
stage('Backend') {
steps {
script{
def root = tool type: 'go', name: 'Go1.16.4'
withEnv(["GOROOT=${root}", "PATH+GO=${root}/bin"]){
sh 'go get github.com/jstemmer/go-junit-report'
sh 'cd store-service && go test -v -coverprofile=coverage.out ./... 2>&1 | go-junit-report > coverage.xml'
junit 'store-service/*.xml'
}
//def scannerHome = tool 'SonarQubeScanner';
//withSonarQubeEnv('SonarQubeScanner'){
// sh "${scannerHome}/bin/sonar-scanner"
//}
}
// sh 'make run_unittest_backend'
// junit 'store-service/*.xml'
// script{
// def scannerHome = tool 'SonarQubeScanner';
// withSonarQubeEnv('SonarQubeScanner'){
// sh "${scannerHome}/bin/sonar-scanner"
// }
// }
}
}
}
}
stage('Setup Test Fixtures') {
steps {
sh 'docker-compose up -d store-database bank-gateway shipping-gateway'
}
}
stage('Run Integration Testing') {
steps {
script{
def root = tool type: 'go', name: 'Go1.16.4'
withEnv(["GOROOT=${root}", "PATH+GO=${root}/bin"]){
sh 'make run_integratetest_backend'
}
}
}
}
stage('Build Docker Images') {
parallel {
stage('Build Frontend') {
steps {
sh 'make build_frontend'
}
}
stage('Build Backend') {
steps {
sh 'make build_backend'
}
}
}
}
stage('Run ATDD') {
steps {
sh 'make start_service'
sh 'make run_newman'
sh 'make run_robot'
// sh 'make stop_service'
}
}
stage('Run Performance Testing') {
steps {
sh 'make run_performance_test_k6'
}
}
}
post {
always {
robot outputPath: './', passThreshold: 100.0
sh 'make stop_service'
sh 'docker volume prune -f'
}
}
}