jest-express
Version:
177 lines (162 loc) • 4.31 kB
YAML
version: 2
docker_defaults:
docker:
- image: circleci/node:10
working_directory: ~/project/jest-express
attach_workspace:
attach_workspace:
at: ~/project
install_steps:
steps:
- checkout
-
- restore_cache:
name: Restore node_modules cache
keys:
- node-modules-{{ .Branch }}-{{ checksum "package-lock.json" }}
- node-modules-{{ .Branch }}-
- node-modules-
- run:
name: Install Greenkeeper Packages
command: |
sudo npm install -g greenkeeper-lockfile@1
- run:
name: Install Dependencies
command: npm i
- run:
name: Updating Lockfiles
command: |
greenkeeper-shrinkwrap-update
greenkeeper-shrinkwrap-upload
- save_cache:
name: Save node_modules cache
key: node-modules-{{ .Branch }}-{{ checksum "package-lock.json" }}
paths:
- node_modules/
- persist_to_workspace:
root: ~/project
paths: jest-express
test_steps:
steps:
- checkout
- restore_cache:
key: node-modules-{{ .Branch }}-{{ checksum "package-lock.json" }}
- run:
name: Install Local Packages
command: npm i
- run:
name: Test Suite
command: npm run test:ci
jobs:
install:
<<:
<<:
npmvet:
<<:
steps:
-
- run:
name: NPM Vet
command: |
sudo npm i -g npmvet
npm run verify:npmvet
tslint:
<<:
steps:
-
- run:
name: Create TSLint report directory
command: mkdir reports && mkdir reports/tslint
- run:
name: TSLint
command: npm run tslint
- store_artifacts:
path: reports/tslint
test-node-10:
<<:
<<:
test-node-12:
working_directory: ~/jest-express
docker:
- image: circleci/node:12
<<:
test-node-13:
working_directory: ~/jest-express
docker:
- image: circleci/node:13
<<:
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
npm run test:coverage:ci
./cc-test-reporter after-build --exit-code $?
npm run 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: npm run ts:build
- persist_to_workspace:
root: ~/project
paths: jest-express
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: npm run semantic-release
workflows:
version: 2
install-test-build-and-publish:
jobs:
- install
- npmvet:
requires:
- install
- tslint:
requires:
- npmvet
- test-node-10:
requires:
- tslint
- test-node-12:
requires:
- tslint
- test-node-13:
requires:
- tslint
- coverage:
requires:
- test-node-10
- test-node-12
- test-node-13
- build-typescript:
requires:
- coverage
- semantic-release:
requires:
- build-typescript