Updating CI config to build correctly

This commit is contained in:
Jeff Avallone 2018-06-05 16:37:43 -04:00
parent 79fa7d073d
commit 10196afec5
1 changed files with 74 additions and 36 deletions

View File

@ -1,64 +1,102 @@
image: node:latest image: node:latest
cache:
paths:
- node_modules
before_script:
- yarn install
stages: stages:
- setup
- test - test
- build - build
- deploy - deploy
.shared_runner: &shared_runner
tags:
- shared
.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
stage: build
dependencies: []
artifacts:
paths:
- build/
script:
- yarn build
.deploy_template: &deploy_template
<<: *shared_runner
<<: *cache_consumer
stage: deploy
script:
- yarn deploy
setup:
<<: *shared_runner
stage: setup
cache:
paths:
- node_modules
script:
- yarn install
test: test:
<<: *shared_runner
<<: *cache_consumer
stage: test stage: test
coverage: '/^Statements\s*:\s*([^%]+)/' coverage: '/^Statements\s*:\s*([^%]+)/'
artifacts: artifacts:
paths: paths:
- reports/ - reports/
script: script:
yarn test - yarn test
tags:
- shared
build: build_preview:
stage: build <<: *build_template
artifacts: <<: *preview_job
paths: variables:
- build/ BANNER: preview
script: DEPLOY_ENV: preview
- yarn build GA_PROPERTY: $PREVIEW_GA_PROPERTY
tags:
- shared build_production:
<<: *build_template
<<: *production_job
variables:
DEPLOY_ENV: production
GA_PROPERTY: $PROD_GA_PROPERTY
deploy_preview: deploy_preview:
stage: deploy <<: *deploy_template
<<: *preview_job
dependencies:
- build_preview
environment: environment:
name: preview name: preview
url: https://preview.regexper.com url: https://preview.regexper.com
variables: variables:
BANNER: preview
CLOUD_FRONT_ID: $PREVIEW_CLOUDFRONT_ID CLOUD_FRONT_ID: $PREVIEW_CLOUDFRONT_ID
DEPLOY_BUCKET: $PREVIEW_DEPLOY_BUCKET DEPLOY_BUCKET: $PREVIEW_DEPLOY_BUCKET
DEPLOY_ENV: preview
GA_PROPERTY: $PREVIEW_GA_PROPERTY
script:
- yarn deploy
only:
- react # TODO: Change to master once merged
tags:
- shared
deploy_production: deploy_production:
stage: deploy <<: *deploy_template
<<: *production_job
dependencies:
- build_production
environment: environment:
name: production name: production
url: https://regexper.com url: https://regexper.com
script: variables:
- yarn deploy CLOUD_FRONT_ID: $PROD_CLOUDFRONT_ID
only: DEPLOY_BUCKET: $PROD_DEPLOY_BUCKET
- tags
tags:
- shared