2018-07-30 13:20:05 +00:00
|
|
|
if: (branch = development) OR (branch = master) OR (type = pull_request) OR (tag IS present)
|
2018-08-09 09:38:43 +00:00
|
|
|
sudo: required
|
|
|
|
services:
|
|
|
|
- docker
|
2018-03-12 08:30:03 +00:00
|
|
|
language: node_js
|
|
|
|
node_js:
|
2019-03-06 14:14:08 +00:00
|
|
|
- "10"
|
2018-03-12 08:30:03 +00:00
|
|
|
os:
|
|
|
|
- linux
|
2018-08-09 10:15:38 +00:00
|
|
|
env:
|
|
|
|
- DOCKER_COMPOSE_VERSION=1.22.0
|
2018-07-30 13:20:05 +00:00
|
|
|
before_install:
|
2018-08-09 11:45:38 +00:00
|
|
|
# Install custom docker-compose version
|
2018-08-09 10:00:02 +00:00
|
|
|
- sudo rm /usr/local/bin/docker-compose
|
|
|
|
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
|
|
|
- chmod +x docker-compose
|
|
|
|
- sudo mv docker-compose /usr/local/bin
|
2018-08-09 11:13:13 +00:00
|
|
|
# Shut down postgres because it blocks our db container's port map to :5432
|
2018-08-09 11:45:38 +00:00
|
|
|
# it comes enabled by default in docker-compose
|
2018-08-09 11:13:13 +00:00
|
|
|
- sudo service postgresql stop
|
|
|
|
# Wait for it to stop
|
|
|
|
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
|
2018-07-30 13:20:05 +00:00
|
|
|
# Needed to deploy pull request and releases
|
|
|
|
- sudo apt-get -y install python-pip python-dev
|
|
|
|
- pip install awscli --upgrade --user
|
2018-03-12 08:30:03 +00:00
|
|
|
before_script:
|
2018-07-30 13:20:05 +00:00
|
|
|
# Used in the tests of the project
|
2018-05-31 18:10:45 +00:00
|
|
|
- export NODE_ENV=testing
|
2018-08-09 09:53:05 +00:00
|
|
|
- git clone https://github.com/gnosis/safe-transaction-history.git
|
|
|
|
- cd safe-transaction-history
|
|
|
|
- git checkout develop
|
|
|
|
- docker-compose build
|
2018-08-09 10:58:14 +00:00
|
|
|
- docker-compose up -d
|
2018-08-09 11:45:38 +00:00
|
|
|
# Give some time to docker to enable all services
|
2018-08-09 11:32:43 +00:00
|
|
|
- sleep 15
|
2018-08-09 09:53:05 +00:00
|
|
|
- cd ..
|
2018-09-28 07:34:48 +00:00
|
|
|
script:
|
|
|
|
- yarn build
|
2018-03-12 08:30:03 +00:00
|
|
|
after_success:
|
2018-08-09 10:37:16 +00:00
|
|
|
- cd safe-transaction-history
|
|
|
|
- docker-compose stop
|
|
|
|
- cd ..
|
2018-03-12 08:30:03 +00:00
|
|
|
- |
|
2018-07-30 13:20:05 +00:00
|
|
|
|
2018-03-12 08:30:03 +00:00
|
|
|
if [ ${TRAVIS_BRANCH} = "master" ]; then
|
|
|
|
export NODE_ENV=production;
|
|
|
|
else
|
|
|
|
export NODE_ENV=development;
|
|
|
|
fi
|
2018-05-31 18:10:45 +00:00
|
|
|
- yarn build-storybook
|
|
|
|
- yarn build
|
2018-07-30 13:20:05 +00:00
|
|
|
# Pull Request - Deploy it to a review environment
|
|
|
|
# Travis doesn't do deploy step with pull requests builds
|
|
|
|
- ./config/travis/deploy_pull_request.sh
|
|
|
|
# Releases (tagged commits) - Deploy it to a release environment
|
|
|
|
- ./config/travis/deploy_release.sh
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
# Development environment
|
|
|
|
- provider: s3
|
|
|
|
bucket: $DEV_BUCKET_NAME
|
|
|
|
access_key_id: $AWS_ACCESS_KEY_ID
|
|
|
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
|
|
skip_cleanup: true
|
|
|
|
local_dir: build_webpack
|
|
|
|
upload-dir: app
|
|
|
|
on:
|
|
|
|
branch: development
|
|
|
|
|
|
|
|
# Development environment - Storybook
|
|
|
|
- provider: s3
|
|
|
|
bucket: $DEV_BUCKET_NAME
|
|
|
|
access_key_id: $AWS_ACCESS_KEY_ID
|
|
|
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
|
|
skip_cleanup: true
|
|
|
|
local_dir: build_storybook
|
|
|
|
upload-dir: storybook
|
|
|
|
on:
|
|
|
|
branch: development
|
|
|
|
|
|
|
|
# Staging environment
|
|
|
|
- provider: s3
|
|
|
|
bucket: $STAGING_BUCKET_NAME
|
|
|
|
access_key_id: $AWS_ACCESS_KEY_ID
|
|
|
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
|
|
skip_cleanup: true
|
|
|
|
local_dir: build_webpack
|
|
|
|
upload-dir: current
|
|
|
|
on:
|
|
|
|
branch: master
|