jest-node-http
Version:
204 lines (188 loc) • 4.86 kB
YAML
version: 2
docker_defaults:
docker:
- image: circleci/node:8
working_directory: ~/project/status-board
attach_workspace:
attach_workspace:
at: ~/project
install_steps:
steps:
- checkout
-
- restore_cache:
name: Restore node_modules cache
keys:
- node-modules-{{ .Branch }}-{{ checksum "yarn.lock" }}
- node-modules-{{ .Branch }}-
- node-modules-
- run:
name: Install Greenkeeper Packages
command: |
sudo npm install -g greenkeeper-lockfile@1
- run:
name: Install Dependencies
command: yarn install
- run:
name: Updating Lockfiles
command: |
greenkeeper-lockfile-update
greenkeeper-lockfile-upload
greenkeeper-shrinkwrap-update
greenkeeper-shrinkwrap-upload
- save_cache:
name: Save node_modules cache
key: node-modules-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- ~/.cache/yarn
- persist_to_workspace:
root: ~/project
paths:
- status-board
test_steps:
steps:
- checkout
- restore_cache:
key: node-modules-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run:
name: Install Local Packages
command: yarn install --ignore-engines
- run:
name: Test Suite
command: yarn test:ci
jobs:
install:
<<:
<<:
npmvet:
<<:
steps:
-
- run:
name: NPM Vet
command: |
yarn global add npmvet
yarn verify:npmvet
nsp:
<<:
steps:
-
- run:
name: Node Security
command: |
yarn global add nsp
yarn verify:nsp
tslint:
<<:
steps:
-
- run:
name: Create TSLint report directory
command: mkdir reports && mkdir reports/tslint
- run:
name: TSLint
command: yarn tslint
- store_artifacts:
path: reports/tslint
test-node-6:
working_directory: ~/status-board
docker:
- image: circleci/node:6
<<:
test-node-7:
working_directory: ~/status-board
docker:
- image: circleci/node:7
<<:
test-node-8:
<<:
<<:
test-node-9:
working_directory: ~/status-board
docker:
- image: circleci/node:9
<<:
coverage:
<<:
steps:
-
- run:
name: Setup Code Climate test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run:
name: Coverage
environment:
JEST_JUNIT_OUTPUT: reports/jest/jest-test-results.xml
command: |
./cc-test-reporter before-build
yarn test:coverage:ci
./cc-test-reporter after-build --exit-code $?
yarn test:coverage:codecov
- store_artifacts:
path: coverage
- store_artifacts:
path: reports/jest
- store_test_results:
path: reports
build-typescript:
<<:
steps:
-
- run:
name: Build JavaScript
command: yarn ts:build
- persist_to_workspace:
root: ~/project
paths:
- status-board
semantic-release:
<<:
steps:
-
- run:
name: Avoid hosts unknown for github
command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
- run:
name: Semantic Release
command: yarn semantic-release
workflows:
version: 2
install-test-build-and-publish:
jobs:
- install
- npmvet:
requires:
- install
- nsp:
requires:
- npmvet
- tslint:
requires:
- nsp
- test-node-6:
requires:
- tslint
- test-node-7:
requires:
- tslint
- test-node-8:
requires:
- tslint
- test-node-9:
requires:
- tslint
- coverage:
requires:
- test-node-6
- test-node-7
- test-node-8
- test-node-9
- build-typescript:
requires:
- coverage
- semantic-release:
requires:
- build-typescript