2018-11-02 10:09:36 +00:00
|
|
|
image: node:9.3
|
2018-10-01 13:12:54 +00:00
|
|
|
|
2018-10-22 11:04:16 +00:00
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
- deploy
|
2018-10-22 10:25:12 +00:00
|
|
|
|
2018-10-22 11:04:16 +00:00
|
|
|
lint:
|
|
|
|
stage: test
|
|
|
|
script:
|
2018-10-25 13:56:55 +00:00
|
|
|
- yarn install
|
2018-10-22 11:04:16 +00:00
|
|
|
- yarn run lint
|
2018-10-01 13:12:54 +00:00
|
|
|
|
|
|
|
flow:
|
2018-10-22 11:04:16 +00:00
|
|
|
stage: test
|
2018-10-01 13:12:54 +00:00
|
|
|
script:
|
|
|
|
- yarn run flow
|
|
|
|
|
2018-10-23 14:31:10 +00:00
|
|
|
unit:
|
2018-10-22 11:04:16 +00:00
|
|
|
stage: test
|
2018-10-01 13:12:54 +00:00
|
|
|
script:
|
2018-10-25 13:56:55 +00:00
|
|
|
- yarn install
|
2018-10-22 11:04:16 +00:00
|
|
|
- yarn run test
|
2018-10-01 13:12:54 +00:00
|
|
|
|
2018-10-23 14:29:33 +00:00
|
|
|
build development:
|
2018-10-22 11:04:16 +00:00
|
|
|
stage: build
|
2018-10-01 13:12:54 +00:00
|
|
|
script:
|
2018-10-25 13:56:55 +00:00
|
|
|
- yarn install
|
2018-10-22 11:04:16 +00:00
|
|
|
- yarn run build:dev
|
|
|
|
artifacts:
|
2018-10-25 14:00:29 +00:00
|
|
|
expire_in: 1 week
|
2018-10-22 11:04:16 +00:00
|
|
|
paths:
|
2018-10-23 14:48:54 +00:00
|
|
|
- build/dev
|
2018-10-22 11:04:16 +00:00
|
|
|
|
2018-10-23 14:29:33 +00:00
|
|
|
build beta:
|
2018-10-22 11:04:16 +00:00
|
|
|
stage: build
|
|
|
|
script:
|
2018-10-25 13:56:55 +00:00
|
|
|
- yarn install
|
2018-10-22 11:04:16 +00:00
|
|
|
- yarn run build:beta
|
2018-11-22 13:22:45 +00:00
|
|
|
only:
|
|
|
|
- beta
|
2018-10-22 11:04:16 +00:00
|
|
|
artifacts:
|
2018-10-25 14:00:29 +00:00
|
|
|
expire_in: 1 week
|
2018-10-22 11:04:16 +00:00
|
|
|
paths:
|
2018-10-23 14:48:54 +00:00
|
|
|
- build/beta
|
2018-10-25 13:39:17 +00:00
|
|
|
- scripts/s3sync.sh
|
2018-10-22 11:04:16 +00:00
|
|
|
|
2018-10-25 12:47:39 +00:00
|
|
|
build stable:
|
2018-10-22 11:04:16 +00:00
|
|
|
stage: build
|
|
|
|
script:
|
2018-10-25 13:56:55 +00:00
|
|
|
- yarn install
|
2018-10-24 21:01:23 +00:00
|
|
|
- yarn run build:stable
|
2018-11-22 13:22:45 +00:00
|
|
|
only:
|
2018-11-22 13:24:10 +00:00
|
|
|
- stable
|
2018-10-22 11:04:16 +00:00
|
|
|
artifacts:
|
2018-10-25 14:00:29 +00:00
|
|
|
expire_in: 1 week
|
2018-10-22 11:04:16 +00:00
|
|
|
paths:
|
2018-10-24 21:01:23 +00:00
|
|
|
- build/stable
|
2018-10-25 13:39:17 +00:00
|
|
|
- scripts/s3sync.sh
|
2018-10-23 14:29:33 +00:00
|
|
|
|
|
|
|
deploy review:
|
|
|
|
stage: deploy
|
2018-10-25 11:56:31 +00:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
dependencies:
|
|
|
|
- build development
|
2018-11-16 14:16:24 +00:00
|
|
|
environment:
|
|
|
|
name: $CI_BUILD_REF_NAME
|
|
|
|
url: $BASE_REVIEW_URL/$CI_BUILD_REF_NAME
|
2018-11-26 15:39:51 +00:00
|
|
|
on_stop: delete review
|
2018-10-23 14:29:33 +00:00
|
|
|
script:
|
|
|
|
- echo "Deploy a review app"
|
2018-10-25 11:56:31 +00:00
|
|
|
- '[ -z "${DEPLOY_BASE_DIR}" ] && echo "Deploy base dir cannot be empty" && exit 255'
|
|
|
|
- env
|
|
|
|
- mkdir -p "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}"
|
|
|
|
- echo "Copy dev build to web server ${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}..."
|
|
|
|
- rsync --delete -va build/dev/ "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}/"
|
2018-10-23 14:29:33 +00:00
|
|
|
only:
|
|
|
|
- branches
|
2018-10-25 11:56:31 +00:00
|
|
|
tags:
|
|
|
|
- deploy
|
2018-10-25 12:47:39 +00:00
|
|
|
|
|
|
|
deploy stage beta:
|
|
|
|
stage: deploy
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
2018-10-25 13:39:17 +00:00
|
|
|
AWS_ACCESS_KEY_ID: $STAGE_AWS_ACCESS_KEY_ID
|
|
|
|
AWS_SECRET_ACCESS_KEY: $STAGE_AWS_SECRET_ACCESS_KEY
|
2018-10-25 12:50:15 +00:00
|
|
|
when: manual
|
2018-10-25 12:47:39 +00:00
|
|
|
dependencies:
|
|
|
|
- build beta
|
|
|
|
script:
|
2018-10-25 13:53:02 +00:00
|
|
|
- scripts/s3sync.sh stage beta
|
2018-10-25 12:47:39 +00:00
|
|
|
only:
|
|
|
|
- beta
|
|
|
|
tags:
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
deploy stage stable:
|
|
|
|
stage: deploy
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
2018-10-25 13:39:17 +00:00
|
|
|
AWS_ACCESS_KEY_ID: $STAGE_AWS_ACCESS_KEY_ID
|
|
|
|
AWS_SECRET_ACCESS_KEY: $STAGE_AWS_SECRET_ACCESS_KEY
|
2018-10-25 12:50:15 +00:00
|
|
|
when: manual
|
2018-10-25 12:47:39 +00:00
|
|
|
dependencies:
|
|
|
|
- build stable
|
|
|
|
script:
|
2018-10-25 13:53:02 +00:00
|
|
|
- scripts/s3sync.sh stage stable
|
2018-10-25 12:47:39 +00:00
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
tags:
|
|
|
|
- deploy
|
2018-11-26 15:39:51 +00:00
|
|
|
|
|
|
|
delete review:
|
|
|
|
before_script: []
|
|
|
|
stage: deploy
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
when: manual
|
|
|
|
environment:
|
|
|
|
name: $CI_BUILD_REF_NAME
|
|
|
|
action: stop
|
|
|
|
script:
|
|
|
|
- '[ -z "${DEPLOY_BASE_DIR}" ] && echo "Deploy dir can not be empty" && exit 1'
|
|
|
|
- '[ -z "${CI_BUILD_REF_NAME}" ] && echo "Build name can not be empty" && exit 1'
|
|
|
|
- '[ ! -d "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}" ] && echo "Folder can not be found, skipping..." && exit 0'
|
|
|
|
- 'rm -r "${DEPLOY_BASE_DIR}/${CI_BUILD_REF_NAME}"'
|
|
|
|
only:
|
|
|
|
- branches
|
|
|
|
tags:
|
|
|
|
- deploy
|