regexper-static/.gitlab-ci.yml

103 lines
1.7 KiB
YAML
Raw Normal View History

2018-06-05 12:41:15 +00:00
image: node:latest
2018-06-05 11:09:06 +00:00
stages:
2018-06-05 20:37:43 +00:00
- setup
2018-06-05 11:09:06 +00:00
- test
- build
- deploy
2018-06-05 20:37:43 +00:00
.shared_runner: &shared_runner
tags:
- shared
2018-06-05 11:09:06 +00:00
2018-06-05 20:37:43 +00:00
.cache_consumer: &cache_consumer
cache:
policy: pull
paths:
- node_modules
.preview_job: &preview_job
only:
- react # TODO: Change to master once merged
.production_job: &production_job
only:
- /^release-.*$/
.build_template: &build_template
<<: *shared_runner
<<: *cache_consumer
2018-06-05 11:09:06 +00:00
stage: build
2018-06-05 20:37:43 +00:00
dependencies: []
2018-06-05 11:09:06 +00:00
artifacts:
paths:
- build/
script:
- yarn build
2018-06-05 20:37:43 +00:00
.deploy_template: &deploy_template
<<: *shared_runner
<<: *cache_consumer
2018-06-05 11:09:06 +00:00
stage: deploy
2018-06-05 20:37:43 +00:00
script:
- yarn deploy
setup:
<<: *shared_runner
stage: setup
cache:
paths:
- node_modules
script:
- yarn install
test:
<<: *shared_runner
<<: *cache_consumer
stage: test
coverage: '/^Statements\s*:\s*([^%]+)/'
artifacts:
paths:
- reports/
script:
- yarn test
build_preview:
<<: *build_template
<<: *preview_job
variables:
BANNER: preview
DEPLOY_ENV: preview
GA_PROPERTY: $PREVIEW_GA_PROPERTY
build_production:
<<: *build_template
<<: *production_job
variables:
DEPLOY_ENV: production
GA_PROPERTY: $PROD_GA_PROPERTY
deploy_preview:
<<: *deploy_template
<<: *preview_job
dependencies:
- build_preview
2018-06-05 11:09:06 +00:00
environment:
name: preview
url: https://preview.regexper.com
variables:
CLOUD_FRONT_ID: $PREVIEW_CLOUDFRONT_ID
DEPLOY_BUCKET: $PREVIEW_DEPLOY_BUCKET
deploy_production:
2018-06-05 20:37:43 +00:00
<<: *deploy_template
<<: *production_job
dependencies:
- build_production
2018-06-05 11:09:06 +00:00
environment:
name: production
url: https://regexper.com
2018-06-05 20:37:43 +00:00
variables:
CLOUD_FRONT_ID: $PROD_CLOUDFRONT_ID
DEPLOY_BUCKET: $PROD_DEPLOY_BUCKET