From 3c3573d010d6d705792e8789834deea73f590e93 Mon Sep 17 00:00:00 2001 From: Yak Jun Xiang Date: Mon, 19 Mar 2018 19:50:16 -0700 Subject: [PATCH] chore(ci): Update ci process (#201) --- .circleci/config.yml | 52 ++++++++++++++++++++++++++++++++------------ package.json | 4 ++-- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8227b9299..da7450c72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,12 +6,15 @@ defaults: &defaults working_directory: ~/repo docker: - - image: circleci/node:8.9.3 + - image: circleci/node:8-stretch version: 2 jobs: - build: + setup: <<: *defaults steps: + - run: + name: "Update npm" + command: "sudo npm i -g npm" - run: name: "Versions" command: | @@ -21,41 +24,62 @@ jobs: - checkout # Download and cache dependencies - restore_cache: - key: neon-{{ checksum "package.json" }} - - run: npm install + keys: + - neon-{{ checksum "package-lock.json" }} + - neon- + - run: npm ci - save_cache: - key: neon-{{ checksum "package.json" }} + key: neon-{{ checksum "package-lock.json" }} paths: - node_modules - integration-test: + build: <<: *defaults steps: - checkout - restore_cache: - key: neon-{{ checksum "package.json" }} - - run: npm run test:integration + keys: + - neon-{{ checksum "package-lock.json" }} + - neon- + - run: npm run prepublishOnly unit-test: <<: *defaults steps: - checkout - restore_cache: - key: neon-{{ checksum "package.json" }} + keys: + - neon-{{ checksum "package-lock.json" }} + - neon- - run: npm run test:unit + integration-test: + <<: *defaults + steps: + - checkout + - restore_cache: + keys: + - neon-{{ checksum "package-lock.json" }} + - neon- + - run: npm run test:integration workflows: version: 2 build_and_test: jobs: - - build - - integration-test: + - setup + - build: requires: - - build + - setup filters: branches: - only: master + ignore: gh-pages - unit-test: requires: - - build + - setup filters: branches: ignore: gh-pages + - integration-test: + requires: + - setup + filters: + branches: + only: master diff --git a/package.json b/package.json index ca214967a..b181bafcc 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "test": "./node_modules/.bin/mocha ./test", "test:unit": "./node_modules/.bin/mocha ./test/unit", "test:integration": "./node_modules/.bin/mocha ./test/integration", - "test:typings": "tsc", + "test:typings": "./node_modules/.bin/tsc", "cover": "cross-env NODE_ENV=test ./node_modules/.bin/nyc ./node_modules/.bin/mocha ./test && ./node_modules/.bin/nyc report --reporter=lcov", "cover:unit": "cross-env NODE_ENV=test ./node_modules/.bin/nyc ./node_modules/.bin/mocha ./test/unit && ./node_modules/.bin/nyc report --reporter=lcov", "cover:integration": "cross-env NODE_ENV=test ./node_modules/.bin/nyc ./node_modules/.bin/mocha ./test/integration && ./node_modules/.bin/nyc report --reporter=lcov", @@ -63,7 +63,7 @@ "build:docs": "cd docs && sphinx-versioning -g ../ -l ./conf.py build docs ../docs/_build/html", "deploy:docs": "cd docs && sphinx-versioning -g ../ -l ./conf.py push docs gh-pages .", "rebuild": "rm -rf ./node_modules && npm install && ./node_modules/.bin/webpack", - "prepublishOnly": "npm run test:typings && npm run lint && npm run build:prod" + "prepublishOnly": "npm run test:typings && npm run lint && npm run build:prod" }, "repository": { "type": "git",