From 503863b6c97141f44b6814c9383d9d2248d574bc Mon Sep 17 00:00:00 2001 From: Jed Watson Date: Thu, 26 Apr 2018 12:10:52 +1000 Subject: [PATCH] Adding changes from #2559 --- .circleci/config.yml | 92 +++++++++++++++++++++++++++++--------------- .editorconfig | 3 ++ package.json | 5 ++- 3 files changed, 67 insertions(+), 33 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 33f123704b..7db81d5b10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,37 +1,67 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details -# version: 2 -jobs: - build: + +docker_defaults: &docker_defaults docker: - - image: circleci/node:8.4 + - image: circleci/node:8.11.1-browsers + working_directory: ~/project/repo - working_directory: ~/repo +attach_workspace: &attach_workspace + attach_workspace: + at: ~/project +install_steps: &install_steps steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- + - checkout + - restore_cache: + name: Restore node_modules cache + keys: + - dependency-cache-{{ .Branch }}-{{ checksum "package.json" }} + - dependency-cache-{{ .Branch }}- + - dependency-cache- + - run: + name: Installing Dependencies + command: | + yarn install --silent + - save_cache: + name: Save node_modules cache + key: dependency-cache-{{ .Branch }}-{{ checksum "package.json" }} + paths: + - node_modules/ + - persist_to_workspace: + root: ~/project + paths: + - repo - - run: yarn install - - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }} - - # Start the examples server so that Cypress can run against them - - run: yarn start - # Install vxfb for Cypress - - run: yarn add xvfb - # Run eslint - - run: yarn lint - # Run tests - - run: yarn test +workflows: + version: 2 + build_pipeline: + jobs: + - build + - unit_test: + requires: + - build + - end_to_end: + requires: + - build +jobs: + build: + <<: *docker_defaults + <<: *install_steps + unit_test: + <<: *docker_defaults + steps: + - *attach_workspace + - run: + name: Running unit tests + command: | + yarn lint + yarn test:jest + yarn coveralls + end_to_end: + <<: *docker_defaults + steps: + - *attach_workspace + - run: + name: Running E2E tests + command: | + yarn e2e diff --git a/.editorconfig b/.editorconfig index d17f0b74b4..f83c0c4d6b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,3 +12,6 @@ indent_size = 2 [*.md] trim_trailing_whitespace = false + +[.circleci/config.yml] +indent_size = 4 diff --git a/package.json b/package.json index a62ba071b3..a44598121c 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "chroma-js": "^1.3.6", "chrono-node": "^1.3.5", "codesandboxer": "^0.1.1", + "concurrently": "^3.5.1", "copy-webpack-plugin": "^4.3.1", "coveralls": "^2.11.12", "cross-env": "^5.1.3", @@ -93,14 +94,14 @@ "scripts": { "build": "nps build && bundlesize", "watch": "nps build.watch", - "cover": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha", - "coveralls": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha && cat coverage/lcov.info | coveralls", + "coveralls": "cat coverage/lcov.info | coveralls", "lint": "eslint .", "deploy": "cross-env NODE_ENV=production nps publish", "start": "webpack-dev-server --progress", "fresh": "rm -rf node_modules && yarn install", "test": "npm run test:jest && npm run test:cypress", "test:jest": "jest --coverage", + "e2e": "concurrently --kill-others --success=first --names 'SERVER,E2E' 'yarn start' 'yarn test:cypress'", "test:cypress": "cypress run --spec ./cypress/integration/select_spec.js", "test:cypress-watch": "node ./node_modules/.bin/cypress open", "precommit": "flow check && lint-staged"