From 778cec6bddd663a7790f137931aae60a458fc963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Herrera=20Guzm=C3=A1n?= Date: Sun, 3 Jun 2018 15:50:44 +0200 Subject: [PATCH] chore: Migrate to CircleCI 2.0 --- .circleci/config.yml | 210 +++++++++++++++++++++++++++++++++++++++++++ circle.yml | 51 ----------- 2 files changed, 210 insertions(+), 51 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 000000000..c86aaf623 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,210 @@ +version: 2 + +aliases: + - &defaults + working_directory: ~/verdaccio + - &node6_executor + docker: + - image: circleci/node:6 + - &node8_executor + docker: + - image: circleci/node:8 + - &node9_executor + docker: + - image: circleci/node:9 + - &node9_browser_executor + docker: + - image: circleci/node:9-browsers + - &node10_executor + docker: + - image: circleci/node:10 + - &default_executor + <<: *node9_executor + - &repo_key + repo-{{ .Branch }}-{{ .Revision }} + - &base_config_key + base-config-{{ .Branch }}-{{ .Revision }} + - &yarn_cache_key + yarn-sha-{{ checksum "yarn.lock" }} + - &restore_repo + restore_cache: + keys: + - *repo_key + - &ignore_branches + filters: + branches: + ignore: + - gh-pages + - l10n_master + - /release\/.*/ + +jobs: + prepare: + <<: *defaults + <<: *default_executor + steps: + - *restore_repo + - checkout + - restore_cache: + key: *base_config_key + - run: + name: 'Base environment setup' + command: | + git config --global user.email "verdacciobot@users.noreply.github.com" + git config --global user.name "Verdaccio bot for Deployments" + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + echo "machine github.com login verdacciobot password $GITHUB_TOKEN" > ~/.netrc + - save_cache: + key: *base_config_key + paths: + - ~/.npmrc + - ~/.gitconfig + - ~/.netrc + - restore_cache: + key: *yarn_cache_key + - run: + name: Install Js dependencies + command: yarn install --no-progress + - run: + name: Prepare CI + command: yarn run pre:ci + - run: + name: Build project + command: yarn run code:build + - save_cache: + key: *yarn_cache_key + paths: + - ~/.yarn + - ~/.cache/yarn + - node_modules + - save_cache: + key: *repo_key + paths: + - ~/verdaccio + + test_node6: + <<: *defaults + <<: *node6_executor + steps: + - *restore_repo + - run: + name: Test with Node 6 + command: yarn run test + + test_node8: + <<: *defaults + <<: *node8_executor + steps: + - *restore_repo + - run: + name: Test with Node 8 + command: yarn run test + + test_node9: + <<: *defaults + <<: *default_executor + steps: + - *restore_repo + - run: + name: Test with Node 9 + command: yarn run test + + test_node10: + <<: *defaults + <<: *node10_executor + steps: + - *restore_repo + - run: + name: Test with Node 10 + command: yarn run test + + test_e2e: + <<: *defaults + <<: *node9_browser_executor + steps: + - *restore_repo + - run: + name: Test End-to-End + command: yarn run test:e2e + + coverage: + <<: *defaults + <<: *default_executor + steps: + - *restore_repo + - run: + name: Publish coverage + command: yarn run coverage:publish + + publish_gh_pages: + <<: *defaults + <<: *default_executor + steps: + - *restore_repo + - restore_cache: + key: *base_config_key + - run: + name: Publish gh-pages + command: | + cd website + yarn install + GIT_USER=verdacciobot USE_SSH=false yarn run publish-gh-pages + + deploy: + <<: *defaults + <<: *default_executor + steps: + - *restore_repo + - restore_cache: + key: *base_config_key + - run: + name: Publish + command: scripts/publish.sh + +workflows: + version: 2 + workflow: + jobs: + - prepare: + <<: *ignore_branches + - test_node6: + requires: + - prepare + <<: *ignore_branches + - test_node8: + requires: + - prepare + <<: *ignore_branches + - test_node9: + requires: + - prepare + <<: *ignore_branches + - test_node10: + requires: + - prepare + <<: *ignore_branches + - test_e2e: + requires: + - prepare + <<: *ignore_branches + - coverage: + requires: + - prepare + <<: *ignore_branches + - publish_gh_pages: + requires: + - test_node6 + - test_node8 + - test_node9 + - test_node10 + - test_e2e + - coverage + <<: *ignore_branches + - deploy: + requires: + - publish_gh_pages + filters: + branches: + ignore: /.*/ + tags: + only: /(v)?[0-9]+(\.[0-9]+)*/ diff --git a/circle.yml b/circle.yml deleted file mode 100644 index e50d12883..000000000 --- a/circle.yml +++ /dev/null @@ -1,51 +0,0 @@ -machine: - environment: - YARN_VERSION: 1.6.0 - PATH: "${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin" - node: - version: 9 -dependencies: - pre: - - git config --global user.email "verdacciobot@users.noreply.github.com" - - git config --global user.name "Verdaccio bot 🤖 for Deployments" - - 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc' - - | - if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION - fi - - nvm install 6 - - nvm install 8 - - nvm install 10 - - cache_directories: - - ~/.yarn - - ~/.cache/yarn - - "node_modules" - override: - - yarn install --no-progress -test: - override: - - yarn run pre:ci - - nvm alias default 6 - - yarn run test - - nvm alias default 8 - - yarn run test - - nvm alias default 9 - - yarn run test - - nvm alias default 10 - - yarn run test - - yarn run test:e2e - - yarn run coverage:publish - - echo "machine github.com login verdacciobot password $GITHUB_TOKEN" > ~/.netrc - - cd website && yarn install && GIT_USER=verdacciobot USE_SSH=false yarn run publish-gh-pages -deployment: - production: - tag: /(v)?[0-9]+(\.[0-9]+)*/ - commands: - - ./scripts/publish.sh -general: - branches: - ignore: - - gh-pages - - l10n_master - - /release\/.*/