-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathJenkinsfile
126 lines (111 loc) · 2.74 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
def cleanUp() {
sh '''#!/bin/bash
pkill -f app.js || true
bash ~/lisk-test/lisk.sh stop
pkill -f selenium -9 || true
pkill -f Xvfb -9 || true
rm -rf /tmp/.X0-lock || true
pkill -f webpack -9 || true
'''
}
node('lisk-explorer-01'){
lock(resource: "lisk-explorer-01", inversePrecedence: true) {
stage ('Prepare Workspace') {
cleanUp()
deleteDir()
checkout scm
}
stage ('Build Dependencies') {
try {
sh '''#!/bin/bash
# Install Deps
npm install --verbose
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, installation failed')
}
}
stage ('Run Webpack Build') {
try {
sh '''#!/bin/bash
# Build Bundles
npm run build
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, webpack failed')
}
}
stage ('Build Candles') {
try {
sh '''#!/bin/bash
# Generate market data
grunt candles:build
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, candles build failed')
}
}
stage ('Start Lisk ') {
try {
sh '''#!/bin/bash
cp test/config_lisk.json ~/lisk-test/config.json
bash ~/lisk-test/lisk.sh rebuild -f ~/lisk-test/blockchain_explorer.db.gz
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, lisk-core failed')
}
}
stage ('Start Explorer') {
try {
sh '''#!/bin/bash
cp test/config.test ./config.js
node $(pwd)/app.js &> ./explorer.log &
sleep 20
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, Explorer failed to start')
}
}
stage ('Run tests') {
try {
sh '''#!/bin/bash
# Run Tests
npm run test
'''
} catch (err) {
cleanUp()
currentBuild.result = 'FAILURE'
error('Stopping build, tests failed')
}
}
stage ('Run e2e tests') {
try {
sh '''#!/bin/bash
# End to End test configuration
export DISPLAY=:99
Xvfb :99 -ac -screen 0 1280x1024x24 &
./node_modules/protractor/bin/webdriver-manager update
./node_modules/protractor/bin/webdriver-manager start &
# Run E2E Tests
npm run e2e-test
'''
} catch (err) {
cleanUp()
currentBuild.result = 'FAILURE'
error('Stopping build, e2e tests failed')
}
}
stage ('Set milestone') {
milestone 1
currentBuild.result = 'SUCCESS'
}
stage ('Cleanup') {
cleanUp()
}
}
}