From 7bc4b65df5d01e085c98122c8c8a79542a26dad9 Mon Sep 17 00:00:00 2001 From: 0xADADA <0xadada.pub@0xadada.pub> Date: Thu, 1 Feb 2018 07:36:01 -0500 Subject: [PATCH] circle-ci speed: multiple parallel build jobs --- .circleci/config.yml | 85 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5f6fa37..4f0e4c8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,40 +3,93 @@ version: 2 # Reusable definitions shared between jobs defs: + defaults: &defaults + docker: + - image: circleci/node:carbon-browsers + working_directory: ~/app steps: - step-update-path: &step-update-path - name: Update $PATH + step-update-env: &step-update-env + name: Update environment command: | - echo "export PATH=$PATH:$(yarn global bin)" >> $BASH_ENV + echo "export PATH=$PATH:$(yarn global bin):~/app/node_modules/.bin" >> $BASH_ENV + git config --global user.email "$CIRCLECI_EMAIL" + git config --global user.name "Circle CI Build Bot" jobs: - build: - docker: - - image: circleci/node:carbon-browsers + checkout_code: + <<: *defaults steps: - checkout - - run: - name: Configure build environment - command: | - git config --global user.email "$CIRCLECI_EMAIL" - git config --global user.name "Circle CI Build Bot" + - persist_to_workspace: + root: . + paths: + - . + install_dependencies: + <<: *defaults + steps: + - attach_workspace: + at: . - restore_cache: - key: dependency-cache-{{ checksum "yarn.lock" }} + keys: + - dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} + - dependency-cache-{{ .Branch }}- + - dependency-cache- - run: name: Install dependencies command: | yarn global add ember-cli@3.0.0-beta.2 yarn - save_cache: - key: dependency-cache-{{ checksum "yarn.lock" }} + key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} paths: - ./node_modules + - persist_to_workspace: + root: . + paths: + - . + lint: + <<: *defaults + steps: + - attach_workspace: + at: . + - run: + <<: *step-update-env + - run: + name: Run linters + command: | + yarn lint + test: + <<: *defaults + steps: + - attach_workspace: + at: . - run: - <<: *step-update-path + <<: *step-update-env - run: - name: Run tests + name: Ember build command: | npm rebuild node-sass 2>&1 > /dev/null ember --version --verbose - yarn test + # see: https://github.com/stefanpenner/broccoli-persistent-filter#warning + BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT=cache; COVERAGE=true ember build -e test --output-path=dist + - run: + name: Ember test + command: | + ember --version --verbose + BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT=cache; yarn test --path=dist yarn coverage + +workflows: + version: 2 + build_lint_test: + jobs: + - checkout_code + - install_dependencies: + requires: + - checkout_code + - lint: + requires: + - install_dependencies + - test: + requires: + - install_dependencies