forked from dcos/dcos-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
142 lines (126 loc) · 3.01 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
139
140
141
142
#!/usr/bin/env groovy
pipeline {
agent {
dockerfile {
args '--shm-size=1g'
}
}
environment {
JENKINS_VERSION = 'yes'
NODE_PATH = 'node_modules'
}
options {
timeout(time: 1, unit: 'HOURS')
}
stages {
stage('Initialization') {
steps {
ansiColor('xterm') {
retry(2) {
sh '''npm --unsafe-perm install'''
}
sh '''npm run scaffold'''
}
}
}
stage('Lint') {
steps {
ansiColor('xterm') {
sh '''npm run lint'''
}
}
}
stage('Unit Test') {
steps {
ansiColor('xterm') {
sh '''npm run test -- --coverage'''
}
}
post {
always {
junit 'jest/test-results/*.xml'
step([$class : 'CoberturaPublisher',
autoUpdateHealth : false,
autoUpdateStability: false,
coberturaReportFile: 'coverage/cobertura-coverage.xml',
failUnhealthy : true,
failUnstable : true,
maxNumberOfBuilds : 0,
onlyStable : false,
sourceEncoding : 'ASCII',
zoomCoverageChart : false])
}
}
}
stage('Build') {
steps {
ansiColor('xterm') {
sh '''npm run build-assets'''
}
}
post {
always {
stash includes: 'dist/*', name: 'dist'
}
}
}
stage('Integration Test') {
steps {
// Run a simple webserver serving the dist folder statically
// before we run the cypress tests
writeFile file: 'integration-tests.sh', text: [
'export PATH=`pwd`/node_modules/.bin:$PATH',
'http-server -p 4200 dist&',
'SERVER_PID=$!',
'cypress run --reporter junit --reporter-options \'mochaFile=cypress/results.xml\'',
'RET=$?',
'echo "cypress exit status: ${RET}"',
'sleep 10',
'echo "kill server"',
'kill $SERVER_PID',
'exit $RET'
].join('\n')
unstash 'dist'
ansiColor('xterm') {
retry(2) {
sh '''bash integration-tests.sh'''
}
}
}
post {
always {
archiveArtifacts 'cypress/**/*'
junit 'cypress/*.xml'
}
}
}
// stage('System Test') {
// steps {
// withCredentials(
// [
// string(
// credentialsId: '8e2b2400-0f14-4e4d-b319-e1360f97627d',
// variable: 'CCM_AUTH_TOKEN'
// )
// ]
// ) {
// unstash 'dist'
//
// ansiColor('xterm') {
// retry(2) {
// sh '''dcos-system-test-driver -v ./system-tests/driver-config/jenkins.sh'''
// }
// }
// }
//
// }
//
// post {
// always {
// archiveArtifacts 'results/**/*'
// junit 'results/results.xml'
// }
// }
// }
}
}