version: 2 jobs: npm_dependencies: working_directory: ~/coralproject/talk docker: - image: circleci/node:8 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: working_directory: ~/coralproject/talk docker: - image: circleci/node:8 steps: - checkout - attach_workspace: at: ~/coralproject/talk - run: name: Perform linting command: yarn lint build_assets: working_directory: ~/coralproject/talk docker: - image: circleci/node:8 steps: - checkout - attach_workspace: at: ~/coralproject/talk - run: name: Build static assets command: yarn build - persist_to_workspace: root: . paths: dist test_unit: working_directory: ~/coralproject/talk 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: working_directory: ~/coralproject/talk docker: - image: circleci/node:8-browsers - image: circleci/mongo:3 - image: circleci/redis:4-alpine environment: NODE_ENV: test steps: - run: name: Setup the database with defaults command: ./bin/cli setup --defaults - run: name: Run the integration tests command: yarn e2e:ci workflows: version: 2 build-and-deploy: jobs: - npm_dependencies - lint: requires: - npm_dependencies - test_unit: requires: - npm_dependencies - build_assets: requires: - npm_dependencies - test_integration: requires: - build_assets