From 1d6c5814cb6656b0293cc3aaf8f05dd407ee38d4 Mon Sep 17 00:00:00 2001 From: Dan Thareja Date: Thu, 30 Aug 2018 00:22:30 +0200 Subject: [PATCH] Upgrade to CircleCI 2.0 --- .circleci/config.yml | 47 ++++++++++++++++++++++++++++++++++++++++++++ circle.yml | 12 ----------- 2 files changed, 47 insertions(+), 12 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 00000000..87c37f24 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,47 @@ +# DO NOT EDIT THIS FILE!! +version: 2 +jobs: + build: + docker: + - image: circleci/node:6.10 + steps: + - checkout + - run: + name: Validating PR + command: | + if [ -n "${CIRCLE_PR_NUMBER}" ]; then + curl https://api.github.com/repos/danthareja/contribute-to-open-source/pulls/$CIRCLE_PR_NUMBER > pull.json + node -e " + var pull = require('./pull.json'); + if (pull.base.ref !== pull.user.login) { + console.log('Invalid PR'); + process.exit(1); + } + " + else + echo "Not a PR build" + exit 1 + fi + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - v1-dependencies- + - run: + name: Installing dependencies + command: npm install + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + - run: + name: Creating artifacts + command: | + set +e + mkdir /tmp/artifacts + npm run lint --silent -- --format json > /tmp/artifacts/eslint.json + npm test --silent -- --reporter json > /tmp/artifacts/mocha.json + - store_artifacts: + path: /tmp/artifacts +notify: + webhooks: + - url: https://p6bex1idt3.execute-api.us-west-1.amazonaws.com/prod/hooks/circleci \ No newline at end of file diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 0e102d58..00000000 --- a/circle.yml +++ /dev/null @@ -1,12 +0,0 @@ -# DO NOT EDIT THIS FILE!! -machine: - node: - version: 6 -test: - override: - - mkdir -p $CIRCLE_TEST_REPORTS/reports - - npm run lint --silent -- --format json > $CIRCLE_TEST_REPORTS/reports/eslint.json - - npm test --silent -- --reporter json > $CIRCLE_TEST_REPORTS/reports/mocha.json -notify: - webhooks: - - url: https://p6bex1idt3.execute-api.us-west-1.amazonaws.com/prod/hooks/circleci