Created
April 26, 2019 06:27
-
-
Save heyayush/97aa7b96fc21b25f68253d2e8574aaa9 to your computer and use it in GitHub Desktop.
Circle-CI config for running sanity tests (lint and unit tests) before PR merge and build deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
defaults: &defaults | |
docker: | |
- image: circleci/node:10.15.3 | |
working_directory: ~/repo | |
jobs: | |
install: | |
<<: *defaults | |
steps: | |
- checkout | |
# Download and cache dependencies | |
- restore_cache: | |
keys: | |
# Find a cache corresponding to this specific package-lock.json checksum | |
# when this file is changed, this key will fail | |
- v1-dependencies-{{ checksum "package.json" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- run: # install npm packages | |
name: Install npm dependencies | |
command: yarn install | |
- save_cache: | |
paths: | |
- node_modules | |
key: v1-dependencies-{{ checksum "package.json" }} | |
lint: | |
<<: *defaults | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "package.json" }} | |
- v1-dependencies- | |
- run: # run lint | |
name: Check Linting | |
command: yarn lint | |
test: | |
<<: *defaults | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "package.json" }} | |
- v1-dependencies- | |
- run: # run tests | |
name: Verify Tests | |
command: yarn test | |
workflows: | |
version: 2 | |
sanity_test: | |
jobs: | |
- install | |
- lint: | |
requires: | |
- install | |
- test: | |
requires: | |
- install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment