-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
114 lines (105 loc) Β· 3.05 KB
/
.travis.yml
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
stages:
- name: "test"
- name: "release"
if: branch = release
- name: "production"
if: branch = master
dist: xenial
language: node_js
node_js:
- 12
cache: npm
before_install:
- export PATH=~/npm/node_modules/.bin:$PATH
- sudo apt-get install -y sshpass
- cd $TRAVIS_BUILD_DIR/server
- >
awk
-v FS==
-v REMOTE_DOCKER_IP="$REMOTE_DOCKER_IP"
-v REMOTE_DOCKER_PORT="$REMOTE_DOCKER_PORT"
'/^REMOTE_DOCKER_IP/{sub($2, REMOTE_DOCKER_IP, $2); print > "test.env"}
/^REMOTE_DOCKER_PORT/{sub($2, REMOTE_DOCKER_PORT, $2); print > "test.env"}'
OFS==
template.env;
cat test.env
install:
- cd $TRAVIS_BUILD_DIR/server
- npm install
- cd $TRAVIS_BUILD_DIR/client
- npm install
jobs:
include:
- stage: test
name: "server lint sequence"
before_script:
- cd $TRAVIS_BUILD_DIR/server
script:
- npm start test.unit
- script:
- npm start test.unit
name: "server test sequence"
before_script:
- cd $TRAVIS_BUILD_DIR/server
- script:
- npm start lint
name: "client lint sequence"
before_script:
- cd $TRAVIS_BUILD_DIR/client
- script:
- npm start test
name: "client test sequence"
before_script:
- cd $TRAVIS_BUILD_DIR/client
- stage: release
name: "deploy server to release server"
script:
- >
sshpass -p "$PROD_USER_PASSWORD"
scp -P $PROD_SERVER_PORT -r -o StrictHostKeyChecking=no
./ $PROD_USER_ID@$PROD_SERVER_HOST:/home/boost/server
- >
sshpass -p "$PROD_USER_PASSWORD"
ssh -p $PROD_SERVER_PORT -o StrictHostKeyChecking=no
$PROD_USER_ID@$PROD_SERVER_HOST "cd server && npm start production"
before_script:
- cd $TRAVIS_BUILD_DIR/server
- script:
- >
sshpass -p $PROD_USER_PASSWORD
scp -P $PROD_SERVER_PORT -r -o StrictHostKeyChecking=no
./dist $PROD_USER_ID@$PROD_SERVER_HOST:/home/boost/client
- >
sshpass -p $PROD_USER_PASSWORD
ssh -p $PROD_SERVER_PORT -o StrictHostKeyChecking=no
$PROD_USER_ID@$PROD_SERVER_HOST "cd client && npm start"
name: "deploy client to release server"
before_script:
- cd $TRAVIS_BUILD_DIR/client
- npm start build
- stage: production
name: "deploy server to production server"
script:
- >
sshpass -p "$PROD_USER_PASSWORD"
scp -P $PROD_SERVER_PORT -r -o StrictHostKeyChecking=no
./ $PROD_USER_ID@$PROD_SERVER_HOST:/home/boost/server
- >
sshpass -p "$PROD_USER_PASSWORD"
ssh -p $PROD_SERVER_PORT -o StrictHostKeyChecking=no
$PROD_USER_ID@$PROD_SERVER_HOST "cd server && npm start production"
before_script:
- cd $TRAVIS_BUILD_DIR/server
- script:
- >
sshpass -p $PROD_USER_PASSWORD
scp -P $PROD_SERVER_PORT -r -o StrictHostKeyChecking=no
./dist $PROD_USER_ID@$PROD_SERVER_HOST:/home/boost/client
- >
sshpass -p $PROD_USER_PASSWORD
ssh -p $PROD_SERVER_PORT -o StrictHostKeyChecking=no
$PROD_USER_ID@$PROD_SERVER_HOST "cd client && npm start"
name: "deploy client to production server"
before_script:
- cd $TRAVIS_BUILD_DIR/client
- npm start build