-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathJenkinsfile
42 lines (36 loc) · 995 Bytes
/
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
node {
def nodeHome = tool name: 'node-9.8.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
env.PATH = "${nodeHome}/bin:${env.PATH}"
stage('check tools') {
sh "node -v"
sh "npm -v"
}
stage('checkout') {
checkout scm
}
stage('npm install') {
sh "npm install"
}
stage('unit tests') {
sh "ng test"
}
stage('protractor tests') {
sh "ng e2e"
}
stage('deploying') {
sh '''
# exit 1 on errors
set -e
# deal with remote
echo "Checking if remote exists..."
if ! git ls-remote heroku; then
echo "Adding heroku remote..."
git remote add heroku https://git.heroku.com/evening-meadow-46789.git
fi
# push only origin/master to heroku/master - will do nothing if
# master doesn't change.
echo "Updating heroku master branch..."
git push heroku origin/master:master
'''
}
}