Skip to content

Instantly share code, notes, and snippets.

@rockchalkwushock
Created August 25, 2017 10: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 rockchalkwushock/4866ddc39cb6e2600c5643642ab96461 to your computer and use it in GitHub Desktop.
Save rockchalkwushock/4866ddc39cb6e2600c5643642ab96461 to your computer and use it in GitHub Desktop.
CircleCi@2.0 config for microauth-vkontakte
version: 2
jobs:
checkout_code:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- checkout
- run: echo $CIRCLE_SHA1 > .circle-sha
- save_cache:
key: v1-repo-{{ checksum ".circle-sha" }}
paths:
- ~/microauth-vkontakte
install_dependencies:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- run: echo $CIRCLE_SHA1 > .circle-sha
- restore_cache:
key: v1-repo-{{ checksum ".circle-sha" }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-
- run: yarn install
- save_cache:
key: v1-dependencies-{{ checksum "yarn.lock" }}
paths:
- ~/microauth-vkontakte/.yarn-cache
test:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- run: echo $CIRCLE_SHA1 > .circle-sha
- restore_cache:
key: v1-repo-{{ checksum ".circle-sha" }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-
# Install dependencies
- run: yarn install
# Using `nsp` check for vulnerabilities in package dependencies.
- run: yarn start validate.dependencies
# Validate the code through: linting, type-checking, & testing that will generate coverage.
- run: yarn start validate.withCoverage
# Report coverage to CodeCov.
- run: yarn start reportCoverage
- store_artifacts:
path: ./coverage/clover.xml
prefix: tests
- store_artifacts:
path: coverage
prefix: coverage
- store_test_results:
path: ./coverage/clover.xml
release:
docker:
- image: circleci/node:latest
working_directory: ~/microauth-vkontakte
steps:
- run: echo $CIRCLE_SHA1 > .circle-sha
- restore_cache:
key: v1-repo-{{ checksum ".circle-sha" }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-
- run: yarn install
# Build the './lib' for distribution.
- run: yarn start build
# Publish to NPM with `semantic-release`.
- run: yarn start release
# Workflows
# https://circleci.com/docs/2.0/configuration-reference/#workflows
# https://circleci.com/docs/2.0/workflows/#branch-level-job-execution
workflows:
version: 2
test_and_release:
jobs:
- checkout_code
- install_dependencies:
requires:
- checkout_code
- test:
requires:
- install_dependencies
- hold:
type: approval
requires:
- test
filters:
branches:
only: master
- release:
requires:
- hold
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment