diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9a9c06a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,92 @@ +version: 2 +workflows: + version: 2 + tests: + jobs: &workflow_jobs + - node6: + filters: + tags: + only: /.*/ + # - node8: + # filters: + # tags: + # only: /.*/ + # - node10: + # filters: + # tags: + # only: /.*/ + - lint: + requires: + - node6 + # - node8 + # - node10 + filters: + tags: + only: /.*/ + - system_tests: + requires: + - lint + filters: + branches: + only: master + tags: + only: '/^v[\d.]+$/' + - publish_npm: + requires: + - system_tests + filters: + branches: + ignore: /.*/ + tags: + only: '/^v[\d.]+$/' +jobs: + node6: + docker: + - image: 'node:6' + steps: &unit_tests_steps + - checkout + - run: + name: Install and configure Cloud SDK + command: | + echo $KEYFILE > key.json + curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-209.0.0-linux-x86_64.tar.gz | tar xz + mv ./google-cloud-sdk /opt + export PATH=$PATH:/opt/google-cloud-sdk/bin + gcloud components install beta -q + gcloud components update -q + gcloud config set project cloud-functions-emulator + gcloud config set compute/region us-central1 + gcloud auth activate-service-account --key-file key.json + - run: yarn + - run: yarn test + - run: node_modules/.bin/codecov + # node8: + # docker: + # - image: 'node:8' + # steps: *unit_tests_steps + # node10: + # docker: + # - image: 'node:10' + # steps: *unit_tests_steps + lint: + docker: + - image: 'node:6' + steps: + - checkout + - run: yarn install + - run: npm run lint + system_tests: + docker: + - image: 'node:6' + user: node + steps: + - checkout + - run: yarn + - run: yarn run system-test + publish_npm: + docker: + - image: 'node:10' + steps: + - checkout + - run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + - run: npm publish diff --git a/circle.yml b/circle.yml deleted file mode 100644 index ac008ca..0000000 --- a/circle.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2017, Google, Inc. -# Licensed under the Apache License, Version 2.0 (the "License") -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# See: -# -# https://circleci.com/docs/configuration/ -# https://circleci.com/docs/install-and-use-yarn/ - -# Adjust the behavior of the virtual machine (VM) -machine: - node: - version: 6.11.5 - -# Use for broader build-related configuration -general: - artifacts: - - "test/system/test-log.txt" - branches: - ignore: - - gh-pages - -# Install your project's language-specific dependencies -dependencies: - pre: - - yarn global add nyc codecov - override: - - yarn - cache_directories: - - ~/.cache/yarn - - /opt/google-cloud-sdk - -# Run your tests -test: - override: - - yarn test - post: - - nyc report --reporter=lcov > coverage.lcov && codecov diff --git a/package.json b/package.json index 7e4d87d..37a9b92 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "2.2.0", + "codecov": "^3.0.4", "intelli-espower-loader": "1.0.1", "mocha": "5.0.1", "nock": "9.1.6",