This repository has been archived by the owner on May 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
125 lines (117 loc) · 6.21 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
115
116
117
118
119
120
121
122
123
124
125
sudo: required
language: node_js
node_js: "8"
jobs:
include:
- cache:
directories:
- node_modules
- release-builds
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- stage: Lint
script: npm run lint
- stage: Audit
script: npm audit --production
- stage: Test
- stage: Coverage
script: npm run coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
- stage: Release desktop application
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
script:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker run --rm \
--env-file <(env | grep -vE '\r|\n' | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:wine \
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn dist -mwl"
else
:
fi
deploy:
provider: releases
api_key: $GH_TOKEN
file_glob: true
file: release-builds/*
skip_cleanup: true
overwrite: true
on:
tags: true
- stage: Build and push image
services:
- docker
install: skip
before_script:
- docker build -t XinFin/XDCmaster .
script:
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- docker tag XinFin/XDCmaster XinFin/XDCmaster:latest
- docker push XinFin/XDCmaster:latest
- docker tag XinFin/XDCmaster XinFin/XDCmaster:$TRAVIS_BUILD_ID
- docker push XinFin/XDCmaster:$TRAVIS_BUILD_ID
- stage: Build and push image (tagged)
services:
- docker
install: skip
before_script:
- docker build -t XinFin/XDCmaster .
script:
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- docker tag XinFin/XDCmaster XinFin/XDCmaster:latest
- docker push XinFin/XDCmaster:latest
- docker tag XinFin/XDCmaster XinFin/XDCmaster:testnet
- docker push XinFin/XDCmaster:testnet
- docker tag XinFin/XDCmaster XinFin/XDCmaster:$TRAVIS_TAG
- docker push XinFin/XDCmaster:$TRAVIS_TAG
- stage: Deploy in devnet
install: skip
before_script:
- openssl aes-256-cbc -K $encrypted_b0062b888c67_key -iv $encrypted_b0062b888c67_iv -in travis.pem.enc -out travis.pem -d
- eval "$(ssh-agent -s)"
- chmod 600 ./travis.pem
- echo -e "Host $DEVNET_SSH_IP\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- ssh-add ./travis.pem
script:
- ssh -i ./travis.pem -l $DEVNET_SSH_USER $DEVNET_SSH_IP docker service update --image XinFin/XDCmaster:latest devnet-main_XDCmaster 1> /dev/null
- ssh -i ./travis.pem -l $DEVNET_SSH_USER $DEVNET_SSH_IP docker service update --image XinFin/XDCmaster:latest devnet-main_XDCmaster_crawler 1> /dev/null
after_success:
- 'curl -X POST --data-urlencode "payload={\"channel\": \"#deployments\", \"username\": \"Travis\", \"attachments\":[{\"fallback\":\"[testnet] Deployment succeeded\",\"pretext\":\"\",\"color\":\"good\",\"fields\":[{\"title\":\"[devnet] XDCMaster\",\"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] XDCMaster\",\"value\":\"Deployment failed.\",\"short\":false}]}], \"icon_emoji\": \":male-construction-worker:\"}" $SLACK_DEPLOY_URL'
- stage: Deploy in testnet
install: skip
before_script:
- openssl aes-256-cbc -K $encrypted_b0062b888c67_key -iv $encrypted_b0062b888c67_iv -in travis.pem.enc -out travis.pem -d
- eval "$(ssh-agent -s)"
- chmod 600 ./travis.pem
- echo -e "Host $TESTNET_SSH_IP\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- ssh-add ./travis.pem
script:
- ssh -i ./travis.pem -l $TESTNET_SSH_USER $TESTNET_SSH_IP docker service update --image XinFin/XDCmaster:testnet testnet_XDCmaster 1> /dev/null
- ssh -i ./travis.pem -l $TESTNET_SSH_USER $TESTNET_SSH_IP docker service update --image XinFin/XDCmaster:testnet testnet_XDCmaster_crawler 1> /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] XDCMaster\",\"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] XDCMaster\",\"value\":\"Deployment failed.\",\"short\":false}]}], \"icon_emoji\": \":male-construction-worker:\"}" $SLACK_DEPLOY_URL'
stages:
- name: Lint
- name: Audit
- name: Test
- name: Coverage
- name: Build and push image
if: type != pull_request AND branch = master AND tag IS blank AND repo = XinFin/XDCmaster
- name: Build and push image (tagged)
if: type != pull_request AND branch =~ ^v AND tag IS present AND repo = XinFin/XDCmaster
- name: Release desktop application
if: type != pull_request AND branch =~ ^v AND tag IS present AND repo = XinFin/XDCmaster
- name: Deploy in devnet
if: type != pull_request AND branch = master AND repo = XinFin/XDCmaster
- name: Deploy in testnet
if: type != pull_request AND branch =~ ^v AND tag IS present AND repo = XinFin/XDCmaster