This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from gnosis/development
Feature - Integration of transaction-history-service V1
- Loading branch information
Showing
138 changed files
with
82,252 additions
and
22,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
build_webpack/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,88 @@ | ||
if: (branch = development) OR (branch = master) OR (type = pull_request) OR (tag IS present) | ||
sudo: required | ||
services: | ||
- docker | ||
language: node_js | ||
node_js: | ||
- "8" | ||
- "9" | ||
os: | ||
- linux | ||
env: | ||
- DOCKER_COMPOSE_VERSION=1.22.0 | ||
before_install: | ||
# Install custom docker-compose version | ||
- 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 | ||
# Shut down postgres because it blocks our db container's port map to :5432 | ||
# it comes enabled by default in docker-compose | ||
- sudo service postgresql stop | ||
# Wait for it to stop | ||
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done | ||
# Needed to deploy pull request and releases | ||
- sudo apt-get -y install python-pip python-dev | ||
- pip install awscli --upgrade --user | ||
before_script: | ||
- yarn global add surge | ||
# Used in the tests of the project | ||
- export NODE_ENV=testing | ||
- git clone https://github.com/gnosis/safe-transaction-history.git | ||
- cd safe-transaction-history | ||
- git checkout develop | ||
- docker-compose build | ||
- docker-compose up -d | ||
# Give some time to docker to enable all services | ||
- sleep 15 | ||
- cd .. | ||
after_success: | ||
- cd safe-transaction-history | ||
- docker-compose stop | ||
- cd .. | ||
- | | ||
if [ ${TRAVIS_BRANCH} = "master" ]; then | ||
export NODE_ENV=production; | ||
else | ||
export NODE_ENV=development; | ||
fi | ||
- yarn build-storybook | ||
- yarn build | ||
- cd build_webpack/ && cp index.html 200.html && cd .. | ||
- chmod ugo+x ./config/deploy/deploy.sh | ||
- ./config/deploy/deploy.sh | ||
# 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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
function deploy_pull_request { | ||
REVIEW_ENVIRONMENT_DOMAIN='review.gnosisdev.com' | ||
|
||
# Pull request name with "pr" prefix | ||
PULL_REQUEST_NAME="pr$TRAVIS_PULL_REQUEST" | ||
|
||
# Feature name without all path. Example gnosis/pm-trading-ui -> pm-trading-ui | ||
REPO_NAME=$(basename $TRAVIS_REPO_SLUG) | ||
# Only alphanumeric characters. Example pm-trading-ui -> pmtradingui | ||
REPO_NAME_ALPHANUMERIC=$(echo $REPO_NAME | sed 's/[^a-zA-Z0-9]//g') | ||
|
||
# TRAVIS_PULL_REQUEST contains pull request number | ||
REVIEW_FEATURE_FOLDER="$REPO_NAME_ALPHANUMERIC/$PULL_REQUEST_NAME" | ||
# Specific for this project only | ||
REVIEW_FEATURE_STORYBOOK_FOLDER="${REPO_NAME_ALPHANUMERIC}storybook/$PULL_REQUEST_NAME" | ||
|
||
# Deploy safe-team project | ||
aws s3 sync build_webpack s3://${REVIEW_BUCKET_NAME}/${REVIEW_FEATURE_FOLDER} --delete | ||
# Deploy safe-team storybook project | ||
aws s3 sync build_storybook s3://${REVIEW_BUCKET_NAME}/${REVIEW_FEATURE_STORYBOOK_FOLDER} --delete | ||
} | ||
|
||
function publish_pull_request_urls_in_github { | ||
REVIEW_FEATURE_URL="https://$PULL_REQUEST_NAME--$REPO_NAME_ALPHANUMERIC.$REVIEW_ENVIRONMENT_DOMAIN" | ||
# Specific for this project only | ||
REVIEW_FEATURE_STORYBOOK_URL="https://$PULL_REQUEST_NAME--${REPO_NAME_ALPHANUMERIC}storybook.$REVIEW_ENVIRONMENT_DOMAIN" | ||
|
||
# Using the Issues api instead of the PR api | ||
# Done so because every PR is an issue, and the issues api allows to post general comments, | ||
# while the PR api requires that comments are made to specific files and specific commits | ||
GITHUB_PR_COMMENTS=https://api.github.com/repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments | ||
curl -H "Authorization: token ${GITHUB_API_TOKEN}" --request POST ${GITHUB_PR_COMMENTS} --data '{"body":"Travis automatic deployment:\r\n '${REVIEW_FEATURE_URL}' \r\n \r\n Storybook book automatic deployment: \r\n '${REVIEW_FEATURE_STORYBOOK_URL}'"}' | ||
} | ||
|
||
# Only: | ||
# - Pull requests | ||
# - Security env variables are available. PR from forks don't have them. | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "$AWS_ACCESS_KEY_ID" ] | ||
then | ||
deploy_pull_request | ||
publish_pull_request_urls_in_github | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Only: | ||
# - Tagged commits | ||
# - Security env variables are available. | ||
if [ -n "$TRAVIS_TAG" ] && [ -n "$AWS_ACCESS_KEY_ID" ] | ||
then | ||
REVIEW_ENVIRONMENT_DOMAIN='review.gnosisdev.com' | ||
|
||
# Feature name without all path. Example gnosis/pm-trading-ui -> pm-trading-ui | ||
REPO_NAME=$(basename $TRAVIS_REPO_SLUG) | ||
# Only alphanumeric characters. Example pm-trading-ui -> pmtradingui | ||
REPO_NAME_ALPHANUMERIC=$(echo $REPO_NAME | sed 's/[^a-zA-Z0-9]//g') | ||
|
||
# Only alphanumeric characters. Example v1.0.0 -> v100 | ||
TRAVIS_TAG_ALPHANUMERIC=$(echo $TRAVIS_TAG | sed 's/[^a-zA-Z0-9]//g') | ||
|
||
REVIEW_RELEASE_FOLDER="$REPO_NAME_ALPHANUMERIC/$TRAVIS_TAG_ALPHANUMERIC" | ||
|
||
# Deploy safe-team release project | ||
aws s3 sync build_webpack s3://${REVIEW_BUCKET_NAME}/${REVIEW_RELEASE_FOLDER} --delete | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.