-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
59 lines (54 loc) ยท 1.91 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
language: node_js
node_js:
- 12
cache: npm
services:
- docker
env:
global:
- DOCKER_USER=wltn3231
jobs:
include:
- stage: Tests
env:
- SKIP_PREFLIGHT_CHECK=true
name: Cocode Client Test
before_install:
- cd ./cocode
install:
- yarn
script:
- yarn test
- name: API Server Test
before_install:
- cd ./api-server
install:
- yarn
script:
- yarn test
- stage: Deploy
if: branch = master AND type = pull_request
before_install:
- openssl aes-256-cbc -K $encrypted_0395e9fbd9ff_key -iv $encrypted_0395e9fbd9ff_iv -in env.tar.enc -out env.tar -d
- tar xvf env.tar
install:
- sudo apt-get install sshpass
before_script:
- echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
- export SERVICE=$TRAVIS_PULL_REQUEST_BRANCH
script:
- echo "deploy ${SERVICE} service"
- cd "$SERVICE"
- docker build -t "$DOCKER_USER"/"$SERVICE":1.0 .
- docker tag "$DOCKER_USER"/"$SERVICE":1.0 "$DOCKER_USER"/"$SERVICE":latest
- docker push "$DOCKER_USER"/"$SERVICE":latest && docker push "$DOCKER_USER"/"$SERVICE":1.0
- |
if [ "${SERVICE}" = "cocode" ]; then
sshpass -p "${COCODE_PASSWORD}" ssh -o StrictHostKeyChecking=no root@"${COCODE_IP}" /root/2019-04/script/deploy.sh "$SERVICE" "$COCODE_PORT"
elif [ "${SERVICE}" = "coconut" ]; then
sshpass -p "${COCONUT_PASSWORD}" ssh -o StrictHostKeyChecking=no root@"${COCONUT_IP}" /root/2019-04/script/deploy.sh "$SERVICE" "$COCONUT_PORT"
elif [ "${SERVICE}" = "api-server" ]; then
sshpass -p "${API_SERVER_PASSWORD}" ssh -o StrictHostKeyChecking=no root@"${API_SERVER_IP}" /root/2019-04/script/deploy.sh "$SERVICE" "$API_SERVER_PORT"
else
echo "${SERVICE} nono!"
fi