# 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 integration: &integration <<: *defaults docker: - image: circleci/node:8-browsers - image: circleci/mongo:3 - image: circleci/redis:4-alpine 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 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_chrome: <<: *integration environment: NODE_ENV: test E2E_BROWSERS: chrome test_integration_firefox: <<: *integration environment: NODE_ENV: test E2E_BROWSERS: firefox test_integration_edge: <<: *integration environment: NODE_ENV: test E2E_BROWSERS: edge deploy: <<: *defaults steps: - checkout - setup_remote_docker - run: name: Deploy the code command: bash ./scripts/docker.sh filter_tags: &filter_tags filters: branches: ignore: /.*/ tags: only: /v[0-9]+(\.[0-9]+)*/ 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_chrome: requires: - build_assets - test_integration_firefox: requires: - build_assets - test_integration_edge: requires: - build_assets - deploy: context: coralproject requires: - lint - test_unit - test_integration_chrome - test_integration_firefox - test_integration_edge deploy-tagged: jobs: - npm_dependencies: <<: *filter_tags - lint: <<: *filter_tags requires: - npm_dependencies - test_unit: <<: *filter_tags requires: - npm_dependencies - build_assets: <<: *filter_tags requires: - npm_dependencies - test_integration_chrome: <<: *filter_tags requires: - build_assets - test_integration_firefox: <<: *filter_tags requires: - build_assets - test_integration_edge: <<: *filter_tags requires: - build_assets - deploy: <<: *filter_tags context: coralproject requires: - lint - test_unit - test_integration_chrome - test_integration_firefox - test_integration_edge