This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
.travis.yml
107 lines (103 loc) · 3.38 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
if: (branch = develop) OR (branch = master) OR (type = pull_request) OR (tag IS present)
language: node_js
node_js:
# TODO: stable (v13.0.1 at the time) breaks sha3 package compilation
# Sticky v12
- '12'
cache:
yarn: true
npm: false
directories:
- .eslint-cache
- .jest-cache
- ~/.cache
script:
- yarn test:coverage
- yarn build
# Integration test, only in tags, master and develop
- if [[ $TRAVIS_TAG != "" || $TRAVIS_BRANCH = master || $TRAVIS_BRANCH = develop ]]; then
yarn test:integration;
fi
before_install:
# Needed to deploy pull request and releases
- sudo apt-get -y install python-pip python-dev
- pip install awscli --upgrade --user
# use production url for price estimator on master or tagged
- export PRICE_ESTIMATOR_URL=$([[ $TRAVIS_BRANCH = master || $TRAVIS_BRANCH = release/* || $TRAVIS_BRANCH = hotfix/* || $TRAVIS_TAG != "" ]] && echo "production" || echo "develop")
before_deploy:
# zip ./dist folder if tag IS present
- if [[ $TRAVIS_TAG != "" && $IPFS_HASH = "" ]]; then
pushd dist;
zip -r $OLDPWD/web_$TRAVIS_TAG.zip *;
popd;
npm install -g ipfs;
jsipfs init;
jsipfs daemon & sleep 10;
export IPFS_HASH=$(jsipfs add dist/ -r --only-hash --quiet | tail -1);
echo "IPFS hash $IPFS_HASH";
jsipfs shutdown;
echo $IPFS_HASH > ipfs_hash.txt;
fi
# compile RELEASE_NOTES.md
- if [[ $TRAVIS_TAG != "" && ! -f RELEASE_NOTES.md ]]; then
LAST_RELEASE_TAG=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/latest 2>/dev/null | jq .tag_name | sed 's/"//g');
echo -e "IPFS hash $IPFS_HASH\n" > RELEASE_NOTES.md;
echo "Commits since $LAST_RELEASE_TAG:" >> RELEASE_NOTES.md;
git log $LAST_RELEASE_TAG.. --oneline --decorate=0 | sed 's/^/- /' >> RELEASE_NOTES.md;
echo "RELEASE_NOTES file contains:";
cat RELEASE_NOTES.md;
fi
after_success:
# add storybook to build
- if [[ $TRAVIS_TAG != "" || $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH = master || $TRAVIS_BRANCH = develop ]]; then
yarn build-storybook -o dist/storybook;
fi
# Pull Request - Deploy it to a review environment
# Travis doesn't do deploy step with pull requests builds
- ./travis/deploy_pull_request.sh
deploy:
- provider: s3
bucket: $DEV_BUCKET_NAME
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
skip_cleanup: true
local_dir: dist
on:
branch: develop
- provider: s3
bucket: $STAGING_BUCKET_NAME
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
skip_cleanup: true
local_dir: dist
upload-dir: current
on:
branch: master
# Prepare production deployment
- provider: s3
bucket: $STAGING_BUCKET_NAME
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
skip_cleanup: true
local_dir: dist
upload-dir: releases/$TRAVIS_TAG
on:
tags: true
- provider: script
script: bash travis/prepare_production_deployment.sh
on:
tags: true
# add release_v*.zip file to tagged Releases on github
- provider: releases
api_key: $GITHUB_RELEASE_TAG_API_TOKEN
release_notes_file: RELEASE_NOTES.md
file:
- web_$TRAVIS_TAG.zip
- ipfs_hash.txt
skip_cleanup: true
on:
tags: true
edge: true