Files
talk/circle.yml
T
2018-02-27 18:43:49 -07:00

137 lines
3.5 KiB
YAML

# The following stanza defines a map named defaults with a variable that may be inserted using the YAML merge (<<: *) key
# later in the file to save some typing. See http://yaml.org/type/merge.html for details.
defaults: &defaults
working_directory: ~/coralproject/talk
docker:
- image: circleci/node:8
version: 2
jobs:
npm_dependencies:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/coralproject/talk
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- run:
name: Install dependancies
command: |
yarn global add node-gyp &&
yarn install --frozen-lockfile
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- persist_to_workspace:
root: .
paths: node_modules
lint:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/coralproject/talk
- run:
name: Perform linting
command: yarn lint
build_assets:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/coralproject/talk
- run:
name: Build static assets
command: yarn build
- persist_to_workspace:
root: .
paths: dist
test_unit:
<<: *defaults
docker:
- image: circleci/node:8
- image: circleci/mongo:3
- image: circleci/redis:4-alpine
environment:
NODE_ENV: test
MOCHA_FILE: /tmp/circleci-test-results/junit/test-results.xml
MOCHA_REPORTER: mocha-junit-reporter
steps:
- checkout
- attach_workspace:
at: ~/coralproject/talk
- run:
name: Setup the test results directory
command: mkdir -p /tmp/circleci-test-results
- run:
name: Run the unit tests
command: yarn test
- store_test_results:
path: /tmp/circleci-test-results
test_integration:
<<: *defaults
docker:
- image: circleci/node:8-browsers
- image: circleci/mongo:3
- image: circleci/redis:4-alpine
environment:
NODE_ENV: test
steps:
- checkout
- attach_workspace:
at: ~/coralproject/talk
- run:
name: Setup the database with defaults
command: ./bin/cli setup --defaults
- run:
name: Run the integration tests
command: yarn e2e:ci
deploy:
<<: *defaults
steps:
- checkout
- setup_remote_docker
- run:
name: Deploy the code
command: bash ./scripts/docker.sh deploy
workflows:
version: 2
build-test-and-deploy:
jobs:
- npm_dependencies
- lint:
requires:
- npm_dependencies
- test_unit:
requires:
- npm_dependencies
- build_assets:
requires:
- npm_dependencies
- test_integration:
requires:
- build_assets
- deploy:
context: coralproject
requires:
- lint
- test_unit
- test_integration
filters:
branches:
only:
- master
- next
deploy-tagged:
jobs:
- deploy:
context: coralproject
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/