-
Notifications
You must be signed in to change notification settings - Fork 56
/
.travis.yml
110 lines (102 loc) · 6.9 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
sudo: required
language: node_js
node_js: "10.6.0"
script: skip
jobs:
include:
- stage: Lint
script:
- cd $TRAVIS_BUILD_DIR/client && npm install && npm run lint
- cd $TRAVIS_BUILD_DIR/server && npm install && npm run lint
# - stage: Audit
# script:
# - cd $TRAVIS_BUILD_DIR/client && npm audit --production
# - cd $TRAVIS_BUILD_DIR/server && npm audit --production
- stage: Tests
script: echo "No tests at the moment"
# - stage: Build and push image
# services:
# - docker
# install: skip
# before_script:
# - docker build -t tomochain/tomoscan-server -f Dockerfile.server .
# - docker build -t tomochain/tomoscan-client -f Dockerfile.client .
# script:
# - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
# - docker tag tomochain/tomoscan-server tomochain/tomoscan-server:latest
# - docker push tomochain/tomoscan-server:latest
# - docker tag tomochain/tomoscan-server tomochain/tomoscan-server:$TRAVIS_BUILD_ID
# - docker push tomochain/tomoscan-server:$TRAVIS_BUILD_ID
# - docker tag tomochain/tomoscan-client tomochain/tomoscan-client:latest
# - docker push tomochain/tomoscan-client:latest
# - docker tag tomochain/tomoscan-client tomochain/tomoscan-client:$TRAVIS_BUILD_ID
# - docker push tomochain/tomoscan-client:$TRAVIS_BUILD_ID
#
# - stage: Build and push image (tagged)
# services:
# - docker
# install: skip
# before_script:
# - docker build -t tomochain/tomoscan-server -f Dockerfile.server .
# - docker build -t tomochain/tomoscan-client -f Dockerfile.client .
# script:
# - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
# - docker tag tomochain/tomoscan-server tomochain/tomoscan-server:latest
# - docker push tomochain/tomoscan-server:latest
# - docker tag tomochain/tomoscan-server tomochain/tomoscan-server:testnet
# - docker push tomochain/tomoscan-server:testnet
# - docker tag tomochain/tomoscan-server tomochain/tomoscan-server:$TRAVIS_TAG
# - docker push tomochain/tomoscan-server:$TRAVIS_TAG
# - docker tag tomochain/tomoscan-client tomochain/tomoscan-client:latest
# - docker push tomochain/tomoscan-client:latest
# - docker tag tomochain/tomoscan-client tomochain/tomoscan-client:testnet
# - docker push tomochain/tomoscan-client:testnet
# - docker tag tomochain/tomoscan-client tomochain/tomoscan-client:$TRAVIS_TAG
# - docker push tomochain/tomoscan-client:$TRAVIS_TAG
- stage: Deploy in devnet
install: skip
before_script:
- openssl enc -aes-256-cbc -d -in newTravis.pem.enc -K $encrypted_1abf86bccdee_key -iv $encrypted_1abf86bccdee_iv -out travis.pem
- eval "$(ssh-agent -s)"
- chmod 600 ./travis.pem
- echo -e "Host $DEVNET_IP\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- ssh-add ./travis.pem
script:
- ssh -i ./travis.pem -l $DEVNET_USER_SSH $DEVNET_IP 'cd tomoscan && git pull origin devnet' > /dev/null
- ssh -i ./travis.pem -l $DEVNET_USER_SSH $DEVNET_IP 'cd tomoscan/client && npm run build' > /dev/null
- ssh -i ./travis.pem -l $DEVNET_USER_SSH $DEVNET_IP 'pm2 restart tomoscan-client tomoscan-crawler tomoscan-producer tomoscan-server tomoscan-trade-process' > /dev/null
# after_success:
# - 'curl -X POST --data-urlencode "payload={\"channel\": \"#deployments\", \"username\": \"Travis\", \"attachments\":[{\"fallback\":\"[devnet] Deployment succeeded\",\"pretext\":\"\",\"color\":\"good\",\"fields\":[{\"title\":\"[devnet] TomoScan\",\"value\":\"Deployment succeeded.\",\"short\":true}]}], \"icon_emoji\": \":male-construction-worker:\"}" $SLACK_DEPLOY_URL'
# after_failure:
# - 'curl -X POST --data-urlencode "payload={\"channel\": \"#deployments\", \"username\": \"Travis\", \"attachments\":[{\"fallback\":\"[devnet] Deployment failed\",\"pretext\":\"\",\"color\":\"danger\",\"fields\":[{\"title\":\"[devnet] TomoScan\",\"value\":\"Deployment failed.\",\"short\":false}]}], \"icon_emoji\": \":male-construction-worker:\"}" $SLACK_DEPLOY_URL'
- stage: Deploy in testnet
install: skip
before_script:
- openssl enc -aes-256-cbc -d -in newTravis.pem.enc -K $encrypted_1abf86bccdee_key -iv $encrypted_1abf86bccdee_iv -out travis.pem
- eval "$(ssh-agent -s)"
- chmod 600 ./travis.pem
- echo -e "Host $TESTNET_IP\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- ssh-add ./travis.pem
script:
- ssh -i ./travis.pem -l $TESTNET_USER_SSH $TESTNET_IP 'cd scan && git pull origin tomodex' > /dev/null
- ssh -i ./travis.pem -l $TESTNET_USER_SSH $TESTNET_IP 'cd scan/ && bash deploy.sh' > /dev/null
# after_success:
# - 'curl -X POST --data-urlencode "payload={\"channel\": \"#deployments\", \"username\": \"Travis\", \"attachments\":[{\"fallback\":\"[testnet] Deployment succeeded\",\"pretext\":\"\",\"color\":\"good\",\"fields\":[{\"title\":\"[testnet] TomoScan\",\"value\":\"Deployment succeeded.\",\"short\":true}]}], \"icon_emoji\": \":male-construction-worker:\"}" $SLACK_DEPLOY_URL'
# after_failure:
# - 'curl -X POST --data-urlencode "payload={\"channel\": \"#deployments\", \"username\": \"Travis\", \"attachments\":[{\"fallback\":\"[testnet] Deployment failed\",\"pretext\":\"\",\"color\":\"danger\",\"fields\":[{\"title\":\"[testnet] TomoScan\",\"value\":\"Deployment failed.\",\"short\":false}]}], \"icon_emoji\": \":male-construction-worker:\"}" $SLACK_DEPLOY_URL'
stages:
- name: Lint
# - name: Audit
- name: Tests
# - name: Build and push image
# if: type != pull_request AND branch = master AND tag IS blank AND repo = tomochain/tomoscan
# - name: Build and push image (tagged)
# if: type != pull_request AND branch =~ ^v AND tag IS present AND repo = tomochain/tomoscan
- name: Deploy in devnet
if: type != pull_request AND branch = devnet AND repo = tomochain/tomoscan
- name: Deploy in testnet
if: type != pull_request AND branch = tomodex AND repo = tomochain/tomoscan
# if: type != pull_request AND branch =~ ^v AND tag IS present AND repo = tomochain/tomoscan
notifications:
slack:
secure: Ua//LHxi433R7KzDMC0CDmDEOrDsiy9KPS1IZCyzMZ03CpLd1oM9iOVBaxxzb3jMSOPoPDpspXPRkYh+NwPyk03uHrg3AWcJds8SD+/ozFbYTfrVaBS+SbnjVaXq1J97Mgr8zOOS4XuCRMIpjsXTIBQ9urG7eWvS+7b3yV9Zvb002kmkpMvtH9xlEK9xHMUJ9XJJr6CyLHBI8OGm6JxsEPaRuXkOWJPr6nmH1FVlMZ1Ku9eKaMqzpIEVFXpjZvGg2LtnD7gV8j5DhA4N4fok5CwlNihd2GfGriJoyyfyMHMsnjmMSyINwSEOUa+4iMZzyY36ug2yxGvA3qvnVdH0PHdf9MLL3ZrlHtgBSRTQjafVjT7knNXObIiPHMU6FRU8dPFc4eChV8ezTW+QrpVy9wSqpEZvN1qnYQPN0N9pUTAAPWc/UlkTPyJEyuZx81UG01mUUvG2cyFsPljIhT3av0TEsirT5MSR8Dgyp3y/8L8SbjVulpxNSU1R4koNvhO8NTMxzGEMJ0m05RwfUkzv4kHtciARv2bJRvwvWdK9qtTadbZHtA6zQA9gNsdKl1/hiHQdneW1Kbg9NdJywPNG15tG3I1WMIrJYf/Fy/O1ynSX7Y1cWzODd2Kr5+gBHBhn35o/GgEfrYVt4LFJ4/rG7U4BF/jqVtjtrTDHhu9DqrE=