diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6a4e3e4 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,191 @@ +defaults: &defaults + working_directory: ~/repo + docker: + - image: circleci/node:8.0 + +whitelist: &whitelist + paths: + - .npmignore + - coverage/* + - dist/* + - node_modules/* + - src/* + - test/* + - vendor/* + - CODE_OF_CONDUCT.md + - LICENSE.md + - package.json + - README.md + - tsconfig.json + - tslint.json + - yarn.lock +version: 2 +jobs: + checkout: + <<: *defaults + + steps: + - checkout + + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - v1-dependencies- + + - run: + name: Install Dependencies + command: yarn install + + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + + - persist_to_workspace: + root: ~/repo + <<: *whitelist + + lint: + <<: *defaults + + steps: + - attach_workspace: + at: ~/repo + + - run: + name: Lint TypeScript code + command: yarn lint + + test: + <<: *defaults + + steps: + - attach_workspace: + at: ~/repo + + - run: + name: Test TypeScript code + command: yarn test:cover + + - persist_to_workspace: + root: ~/repo + <<: *whitelist + + coveralls: + <<: *defaults + + steps: + - attach_workspace: + at: ~/repo + + - run: + name: Submit coverage report to Coveralls.io + command: yarn coveralls + + build: + <<: *defaults + + steps: + - attach_workspace: + at: ~/repo + + - run: + name: Build TypeScript code + command: yarn build + + - persist_to_workspace: + root: ~/repo + <<: *whitelist + + deploy: + <<: *defaults + + steps: + - attach_workspace: + at: ~/repo + + - run: + name: Write NPM Token to ~/.npmrc + command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + + - run: + name: Install dot-json package + command: npm install dot-json + + - run: + name: Write version to package.json + command: $(yarn bin)/dot-json package.json version ${CIRCLE_TAG:1} + + - run: + name: Publish to NPM + command: npm publish --access=public + +workflows: + version: 2 + + build: + jobs: + - checkout + - test: + requires: + - checkout + - lint: + requires: + - checkout + - coveralls: + requires: + - test + - build: + requires: + - test + - lint + + release: + jobs: + - checkout: + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + - test: + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + requires: + - checkout + - lint: + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + requires: + - checkout + - coveralls: + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + requires: + - test + - build: + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + requires: + - test + - lint + - deploy: + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ + requires: + - build \ No newline at end of file diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 5a351c4..0000000 --- a/circle.yml +++ /dev/null @@ -1,26 +0,0 @@ -machine: - node: - version: 6.10.0 - -dependencies: - override: - - yarn - -test: - pre: - - yarn lint - override: - - yarn build - - yarn test:cover - post: - - yarn coveralls - cache_directories: - - ~/.cache/yarn - -deployment: - release: - tag: /v[0-9]+(\.[0-9]+)*/ - commands: - - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/serverless-stack-output/.npmrc - - $(yarn bin)/dot-json package.json version ${CIRCLE_TAG:1} - - npm publish