From ddefaa2c2d7d99cf6067d676fff111e699055215 Mon Sep 17 00:00:00 2001 From: Alvin Huang Date: Thu, 20 Dec 2018 13:51:48 -0500 Subject: [PATCH] test circleci --- .circleci/config.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 89b12067cd..54b80a9e9e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,6 +32,60 @@ jobs: name: website deploy command: ./scripts/deploy.sh + frontend-cache: + docker: + - image: circleci/node:8-browsers + steps: + - checkout + + # cache yarn deps + - restore_cache: + key: consul-frontend-v12-{{ checksum "ui-v2/yarn.lock" }} + + - run: + name: install yarn packages + command: cd ui-v2 && yarn install + + - save_cache: + key: consul-frontend-v2-{{ checksum "ui-v2/yarn.lock" }} + paths: + - ui-v2/node_modules + + # build ember so frontend tests run faster + ember-build: + docker: + - image: circleci/node:8-browsers + steps: + - checkout + - restore_cache: + key: consul-frontend-v2-{{ checksum "ui-v2/yarn.lock" }} + - run: cd ui-v2 && npx yarn build --output-path=dist + + # saves the build to a workspace to be passed to a downstream job + - persist_to_workspace: + root: ui-v2 + paths: + - dist + # job to run ember frontend tests + ember-test: + docker: + - image: circleci/node:8-browsers + environment: + EMBER_TEST_PARALLEL: true #enables test parallelization with ember-exam + EMBER_TEST_REPORT: test-results/report.xml #outputs test report for CircleCI test summary + parallelism: 4 + steps: + - checkout + - restore_cache: + key: consul-frontend-v2-{{ checksum "ui-v2/yarn.lock" }} + - attach_workspace: + at: ui-v2 + - run: + working_directory: ui-v2 + command: node_modules/ember-cli/bin/ember exam --split=$CIRCLE_NODE_TOTAL --partition=`expr $CIRCLE_NODE_INDEX + 1` --path dist --silent -r xunit + - store_test_results: + path: ui-v2/test-results + workflows: version: 2 website: @@ -41,3 +95,12 @@ workflows: filters: branches: only: stable-website + frontend: + jobs: + - frontend-cache + - ember-build: + requires: + - frontend-cache + - ember-test: + requires: + - ember-build