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 30
/
Copy pathJenkinsfile
67 lines (66 loc) · 1.6 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
@Library('lisk-jenkins') _
pipeline {
agent { node { label 'lisk-commander' } }
stages {
stage('Install dependencies') {
steps {
nvm(getNodejsVersion()) {
sh 'npm ci'
}
}
}
stage('Run lint') {
steps {
ansiColor('xterm') {
nvm(getNodejsVersion()) {
sh 'npm run lint'
}
}
}
}
stage('Build') {
steps {
nvm(getNodejsVersion()) {
sh 'npm run build'
}
}
}
stage('Run tests') {
steps {
ansiColor('xterm') {
nvm(getNodejsVersion()) {
sh 'LISK_COMMANDER_CONFIG_DIR=$WORKSPACE/.lisk-commander npm run test'
withCredentials([string(credentialsId: 'lisk-commander-coveralls-token', variable: 'COVERALLS_REPO_TOKEN')]) {
sh 'npm run cover'
}
}
}
}
}
}
post {
success {
script {
build_info = getBuildInfo()
liskSlackSend('good', "Recovery: build ${build_info} was successful.")
}
githubNotify context: 'continuous-integration/jenkins/lisk-commander', description: 'The build passed.', status: 'SUCCESS'
dir('node_modules') {
deleteDir()
}
}
failure {
script {
build_info = getBuildInfo()
liskSlackSend('danger', "Build ${build_info} failed (<${env.BUILD_URL}/console|console>, <${env.BUILD_URL}/changes|changes>)\n")
}
githubNotify context: 'continuous-integration/jenkins/lisk-commander', description: 'The build failed.', status: 'FAILURE'
}
aborted {
githubNotify context: 'continuous-integration/jenkins/lisk-commander', description: 'The build was aborted.', status: 'ERROR'
}
always {
sh 'rm -f $WORKSPACE/.lisk-commander/config.lock'
}
}
}