2018-11-16 19:01:02 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build-website:
|
|
|
|
# setting the working_directory along with the checkout path allows us to not have
|
|
|
|
# to cd into the website/ directory for commands
|
|
|
|
working_directory: ~/project/website
|
|
|
|
docker:
|
|
|
|
- image: hashicorp/middleman-hashicorp:0.3.35
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
path: ~/project
|
|
|
|
|
|
|
|
# restores gem cache
|
|
|
|
- restore_cache:
|
|
|
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: install gems
|
|
|
|
command: bundle check || bundle install --path vendor/bundle --retry=3
|
|
|
|
|
|
|
|
# saves gem cache if we have changed the Gemfile
|
|
|
|
- save_cache:
|
|
|
|
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
|
|
|
|
paths:
|
|
|
|
- ~/project/website/vendor/bundle
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: middleman build
|
|
|
|
command: bundle exec middleman build
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: website deploy
|
|
|
|
command: ./scripts/deploy.sh
|
|
|
|
|
2018-12-20 18:51:48 +00:00
|
|
|
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
|
|
|
|
|
2018-11-16 19:01:02 +00:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
website:
|
|
|
|
jobs:
|
|
|
|
- build-website:
|
|
|
|
context: static-sites
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: stable-website
|
2018-12-20 18:51:48 +00:00
|
|
|
frontend:
|
|
|
|
jobs:
|
|
|
|
- frontend-cache
|
|
|
|
- ember-build:
|
|
|
|
requires:
|
|
|
|
- frontend-cache
|
|
|
|
- ember-test:
|
|
|
|
requires:
|
|
|
|
- ember-build
|