From 135f1db69752bb20a7c1053152fd26a954126efe Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Thu, 28 Dec 2017 22:29:09 +0200 Subject: [PATCH] Feature/fix for circle (#2) (#3) * Feature/fix for circle (#2) * Changes for public npm repos. * Added public access to the npm publish command * feature/continuous Integration v2 (#4) * final draft circleci v2 config 10:19:31 * final draft circleci v2 config 10:26:50 * final draft circleci v2 config 11:06:34 --- .circleci/config.yml | 105 +++++++++++++++++++++++++++++++++++++++++++ circle.yml | 29 ------------ package.json | 2 +- 3 files changed, 106 insertions(+), 30 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..7d886fd --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,105 @@ +# CircleCI v2 Config +version: 2 + +defaults: &defaults + working_directory: /home/circleci/project + docker: + - image: circleci/node:6.10.3 + +jobs: + setup: + <<: *defaults + steps: + - checkout + - run: + name: Update NPM install + command: sudo npm install + - save_cache: + key: dependency-cache-{{ checksum "package.json" }} + paths: + - node_modules + test-unit: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: Create dir for test results + command: mkdir -p ./test/results + - run: + name: Execute unit tests + command: npm -s run test:xunit > ./test/results/tape.xml + - store_artifacts: + path: ./test/results + prefix: test + - store_test_results: + path: ./test/results + test-coverage: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: Execute code coverage check + command: npm -s run test:coverage-check + - store_artifacts: + path: coverage + prefix: test + - store_test_results: + path: coverage/lcov.info + deploy: + <<: *defaults + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: Update NPM registry auth token + command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc + - run: + name: Publish NPM artifact + command: npm publish --access public + +workflows: + version: 2 + build_and_test: + jobs: + - setup: + context: org-global + filters: + branches: + ignore: + - /feature*/ + - /bugfix*/ + - test-unit: + context: org-global + requires: + - setup + filters: + branches: + ignore: + - /feature*/ + - /bugfix*/ + - test-coverage: + context: org-global + requires: + - setup + filters: + branches: + ignore: + - /feature*/ + - /bugfix*/ + - deploy: + context: org-global + requires: + - setup + - test-unit + - test-coverage + filters: + tags: + only: /v[0-9]+(\.[0-9]+)*/ + branches: + only: + - master diff --git a/circle.yml b/circle.yml deleted file mode 100644 index c7dca5b..0000000 --- a/circle.yml +++ /dev/null @@ -1,29 +0,0 @@ -general: - branches: - ignore: - - master - -machine: - node: - version: 6.5.0 - -dependencies: - pre: - - curl -udwolla:$NPM_TOKEN "https://modusbox.jfrog.io/modusbox/api/npm/level1-npm-release/auth/leveloneproject" >> .npmrc - -test: - pre: - - mkdir -p ./test/results - override: - - set -o pipefail && npm -s run test:xunit > ./test/results/tape.xml - - set -o pipefail && npm -s run test:coverage-check - post: - - cp ./test/results/* $CIRCLE_TEST_REPORTS - - mv ./coverage $CIRCLE_ARTIFACTS - -deployment: - production: - tag: /v[0-9]+(\.[0-9]+)*/ - commands: - - npm publish - - aws s3 cp $CIRCLE_ARTIFACTS/coverage/lcov.info s3://elasticbeanstalk-us-west-2-886403637725/sonar/central-services-database/lcov.info diff --git a/package.json b/package.json index acd15ba..b51061f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,6 @@ "tapes": "4.1.0" }, "publishConfig": { - "registry": "https://modusbox.jfrog.io/modusbox/api/npm/level1-npm-release" + "registry": "https://registry.npmjs.org/" } }