Skip to content

Instantly share code, notes, and snippets.

@dipsywong98
Created August 26, 2021 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dipsywong98/9979eaed73767bfe84d3ed7f5b5c89dc to your computer and use it in GitHub Desktop.
Save dipsywong98/9979eaed73767bfe84d3ed7f5b5c89dc to your computer and use it in GitHub Desktop.
image: node:latest
services:
- redis:latest
variables:
REDIS_URL: redis://redis:6379
REDIS_PORT: 6379
stages:
- install
- test
- deploy
install:
stage: install
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
script:
- yarn install --frozen-lockfile
only:
changes:
- yarn.lock
unit:
stage: test
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
script:
- yarn test:unit --reporters=default --reporters=jest-junit
artifacts:
when: always
reports:
junit:
- junit.xml
acceptance:
stage: test
cache:
- key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
- paths:
- coverage/
script:
- yarn test:acceptance --reporters=default --reporters=jest-junit
artifacts:
when: always
paths:
- coverage/
reports:
junit:
- junit.xml
cobertura: coverage/cobertura-coverage.xml
build:
stage: test
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
script:
- yarn build
artifacts:
paths:
- dist
lint:
stage: test
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
script:
- yarn lint
deploy:
stage: deploy
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=my-app --api-key=$HEROKU_API_KEY_DEV
only:
- master
pages:
stage: deploy
dependencies:
- acceptance
script:
- mkdir .public
- cp -r coverage/* .public
- mv .public public
artifacts:
paths:
- public
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment