This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Jenkinsfile
128 lines (112 loc) · 2.9 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
node('lisk-nano-01'){
lock(resource: "lisk-nano-01", inversePrecedence: true) {
stage ('Cleanup Orphaned Processes') {
try {
sh '''
# Clean up old processes
cd ~/lisk-test-nano
bash lisk.sh stop_node
pkill -f selenium -9 || true
pkill -f Xvfb -9 || true
rm -rf /tmp/.X0-lock || true
pkill -f webpack -9 || true
'''
} catch (err) {
currentBuild.result = 'FAILURE'
milestone 1
error('Stopping build, installation failed')
}
}
stage ('Prepare Workspace') {
try {
deleteDir()
checkout scm
} catch (err) {
currentBuild.result = 'FAILURE'
milestone 1
error('Stopping build, Checkout failed')
}
}
stage ('Start Lisk Core') {
try {
sh '''#!/bin/bash
cd ~/lisk-test-nano
bash lisk.sh rebuild -0
'''
} catch (err) {
currentBuild.result = 'FAILURE'
milestone 1
error('Stopping build, Lisk Core failed to start')
}
}
stage ('Build Nano') {
try {
sh '''#!/bin/bash
# Install Electron
npm install
# Build nano
cd $WORKSPACE
npm install
# Add coveralls config file
cp ~/.coveralls.yml-nano .coveralls.yml
# Run Build
npm run build
'''
} catch (err) {
currentBuild.result = 'FAILURE'
milestone 1
error('Stopping build, Nano build failed')
}
}
stage ('Run Tests') {
try {
sh '''
export ON_JENKINS=true
# Start xvfb
export DISPLAY=:99
Xvfb :99 -ac -screen 0 1280x1024x24 &
# Run test
cd $WORKSPACE
npm run test
# Submit coverage to coveralls
cat coverage/*/lcov.info | coveralls -v
'''
} catch (err) {
currentBuild.result = 'FAILURE'
error('Stopping build, Test suite failed')
}
}
stage ('Start Dev Server and Run Tests') {
try {
sh '''
# Prepare lisk core for testing
bash ./e2e-transactions.sh
# Run Dev build and Build
cd $WORKSPACE
export NODE_ENV=
npm run dev &> .lisk-nano.log &
sleep 30
# End to End test configuration
export DISPLAY=:99
Xvfb :99 -ac -screen 0 1280x1024x24 &
./node_modules/protractor/bin/webdriver-manager update
# Run End to End Tests
npm run e2e-test
cd ~/lisk-test-nano
bash lisk.sh stop_node
pkill -f selenium -9 || true
pkill -f Xvfb -9 || true
rm -rf /tmp/.X0-lock || true
pkill -f webpack -9 || true
'''
} catch (err) {
currentBuild.result = 'FAILURE'
milestone 1
error('Stopping build, End to End Test suite failed')
}
}
stage ('Set milestone') {
milestone 1
}
}
}