2020-11-03 09:01:10 +01:00
|
|
|
if: (branch = development) OR (branch = master) OR (type = pull_request) OR (tag IS present)
|
2020-12-09 16:45:06 -03:00
|
|
|
dist: focal
|
2018-03-12 09:30:03 +01:00
|
|
|
language: node_js
|
|
|
|
node_js:
|
2020-08-07 20:02:06 +04:00
|
|
|
- '12'
|
2018-03-12 09:30:03 +01:00
|
|
|
os:
|
|
|
|
- linux
|
2019-09-24 18:24:03 +02:00
|
|
|
matrix:
|
|
|
|
include:
|
2020-05-20 16:15:21 -03:00
|
|
|
- env:
|
|
|
|
- REACT_APP_NETWORK='mainnet'
|
|
|
|
- STAGING_BUCKET_NAME=${STAGING_MAINNET_BUCKET_NAME}
|
2020-10-30 16:55:40 -03:00
|
|
|
- REACT_APP_SENTRY_DSN=${SENTRY_DSN_MAINNET}
|
|
|
|
- SENTRY_PROJECT=${SENTRY_PROJECT_MAINNET}
|
|
|
|
- REACT_APP_GOOGLE_ANALYTICS=${REACT_APP_GOOGLE_ANALYTICS_ID_MAINNET}
|
2020-05-20 16:15:21 -03:00
|
|
|
- REACT_APP_GNOSIS_APPS_URL=${REACT_APP_GNOSIS_APPS_URL_PROD}
|
|
|
|
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
|
|
|
- env:
|
|
|
|
- REACT_APP_NETWORK='rinkeby'
|
2020-10-30 16:55:40 -03:00
|
|
|
- REACT_APP_SENTRY_DSN=${SENTRY_DSN_RINKEBY}
|
|
|
|
- SENTRY_PROJECT=${SENTRY_PROJECT_RINKEBY}
|
2020-10-19 13:38:12 +02:00
|
|
|
- REACT_APP_GOOGLE_ANALYTICS=${REACT_APP_GOOGLE_ANALYTICS_ID_RINKEBY}
|
2020-05-20 16:15:21 -03:00
|
|
|
- REACT_APP_GNOSIS_APPS_URL=${REACT_APP_GNOSIS_APPS_URL_STAGING}
|
2020-10-18 16:48:22 -03:00
|
|
|
- env:
|
|
|
|
- REACT_APP_NETWORK='xdai'
|
|
|
|
- STAGING_BUCKET_NAME=${STAGING_XDAI_BUCKET_NAME}
|
2020-10-30 16:55:40 -03:00
|
|
|
- REACT_APP_SENTRY_DSN=${SENTRY_DSN_XDAI}
|
|
|
|
- SENTRY_PROJECT=${SENTRY_PROJECT_XDAI}
|
|
|
|
- REACT_APP_GOOGLE_ANALYTICS=${REACT_APP_GOOGLE_ANALYTICS_ID_XDAI}
|
2020-11-02 09:45:59 +01:00
|
|
|
if: (branch = master) OR tag IS present
|
2020-10-28 09:10:40 -03:00
|
|
|
- env:
|
|
|
|
- REACT_APP_NETWORK='volta'
|
|
|
|
- STAGING_BUCKET_NAME=${STAGING_VOLTA_BUCKET_NAME}
|
2020-10-30 16:55:40 -03:00
|
|
|
- REACT_APP_SENTRY_DSN=${SENTRY_DSN_VOLTA}
|
|
|
|
- SENTRY_PROJECT=${SENTRY_PROJECT_VOLTA}
|
|
|
|
- REACT_APP_GOOGLE_ANALYTICS=${REACT_APP_GOOGLE_ANALYTICS_ID_VOLTA}
|
2021-01-27 19:15:17 +01:00
|
|
|
if: (branch = master) OR tag IS present
|
2020-10-28 09:10:40 -03:00
|
|
|
- env:
|
|
|
|
- REACT_APP_NETWORK='energy_web_chain'
|
|
|
|
- STAGING_BUCKET_NAME=${STAGING_EWC_BUCKET_NAME}
|
2020-10-30 16:55:40 -03:00
|
|
|
- REACT_APP_SENTRY_DSN=${SENTRY_DSN_EWC}
|
|
|
|
- SENTRY_PROJECT=${SENTRY_PROJECT_EWC}
|
|
|
|
- REACT_APP_GOOGLE_ANALYTICS=${REACT_APP_GOOGLE_ANALYTICS_ID_EWC}
|
2020-11-03 09:01:10 +01:00
|
|
|
if: (branch = master AND NOT type = pull_request) OR tag IS present
|
2020-06-04 10:56:55 -03:00
|
|
|
cache:
|
2020-12-04 18:38:49 +01:00
|
|
|
npm: false
|
2021-02-10 11:51:20 +01:00
|
|
|
yarn: true
|
2020-09-29 17:14:30 +02:00
|
|
|
before_script:
|
|
|
|
- if [[ -n "$TRAVIS_TAG" ]]; then export REACT_APP_ENV='production'; fi;
|
2020-10-28 09:10:40 -03:00
|
|
|
- if [ $TRAVIS_PULL_REQUEST != "false" ]; then export PUBLIC_URL="/${REACT_APP_NETWORK}/app"; fi;
|
2018-07-30 15:20:05 +02:00
|
|
|
before_install:
|
|
|
|
# Needed to deploy pull request and releases
|
2019-12-16 16:26:21 +04:00
|
|
|
- sudo apt-get update
|
2020-12-09 16:45:06 -03:00
|
|
|
- sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev
|
2018-07-30 15:20:05 +02:00
|
|
|
- pip install awscli --upgrade --user
|
2018-09-28 09:34:48 +02:00
|
|
|
script:
|
2020-09-24 16:04:35 +02:00
|
|
|
- yarn prettier:check
|
|
|
|
- yarn test:coverage
|
|
|
|
- yarn build
|
2020-10-30 16:55:40 -03:00
|
|
|
- if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" ]] || [ -n "$TRAVIS_TAG" ]; then
|
2020-11-03 09:54:26 +01:00
|
|
|
echo "Upload sentry source maps";
|
2020-10-30 16:55:40 -03:00
|
|
|
yarn sentry-upload-sourcemaps;
|
|
|
|
else
|
|
|
|
echo "Skip source map upload";
|
|
|
|
fi;
|
2018-03-12 09:30:03 +01:00
|
|
|
after_success:
|
2018-07-30 15:20:05 +02: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
|
2020-06-24 11:18:14 -03:00
|
|
|
- yarn coveralls
|
2018-07-30 15:20:05 +02:00
|
|
|
|
|
|
|
deploy:
|
2020-11-06 08:36:26 +01:00
|
|
|
# Development environment only on rinkeby
|
2020-05-20 16:15:21 -03:00
|
|
|
- provider: s3
|
|
|
|
bucket: $DEV_BUCKET_NAME
|
|
|
|
access_key_id: $AWS_ACCESS_KEY_ID
|
|
|
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
|
|
skip_cleanup: true
|
2020-05-21 15:42:11 +04:00
|
|
|
local_dir: build
|
2020-10-18 16:48:22 -03:00
|
|
|
upload_dir: app
|
2020-05-20 16:15:21 -03:00
|
|
|
region: $AWS_DEFAULT_REGION
|
|
|
|
on:
|
|
|
|
branch: development
|
2020-11-06 08:36:26 +01:00
|
|
|
condition: $REACT_APP_NETWORK = rinkeby
|
2018-07-30 15:20:05 +02:00
|
|
|
|
2020-10-18 16:48:22 -03:00
|
|
|
# Staging environment
|
2020-05-20 16:15:21 -03:00
|
|
|
- provider: s3
|
|
|
|
bucket: $STAGING_BUCKET_NAME
|
|
|
|
access_key_id: $AWS_ACCESS_KEY_ID
|
|
|
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
|
|
skip_cleanup: true
|
2020-05-21 15:42:11 +04:00
|
|
|
local_dir: build
|
2020-10-18 16:48:22 -03:00
|
|
|
upload_dir: current/app
|
2020-05-20 16:15:21 -03:00
|
|
|
region: $AWS_DEFAULT_REGION
|
|
|
|
on:
|
|
|
|
branch: master
|
2019-09-25 19:06:41 +02:00
|
|
|
|
2020-10-18 16:48:22 -03:00
|
|
|
# Prepare production deployment
|
2020-05-20 16:15:21 -03:00
|
|
|
- provider: s3
|
|
|
|
bucket: $STAGING_BUCKET_NAME
|
|
|
|
secret_access_key: $AWS_SECRET_ACCESS_KEY
|
|
|
|
access_key_id: $AWS_ACCESS_KEY_ID
|
|
|
|
skip_cleanup: true
|
2020-05-21 15:42:11 +04:00
|
|
|
local_dir: build
|
2020-10-18 16:48:22 -03:00
|
|
|
upload_dir: releases/$TRAVIS_TAG
|
2020-05-20 16:15:21 -03:00
|
|
|
region: $AWS_DEFAULT_REGION
|
|
|
|
on:
|
|
|
|
tags: true
|
|
|
|
- provider: script
|
|
|
|
script: ./config/travis/prepare_production_deployment.sh
|
|
|
|
on:
|
|
|
|
tags: true
|