From 0e5b238d285274ae86dccba35c05046d22fc031c Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Mon, 19 Mar 2018 11:17:32 +0100 Subject: [PATCH 1/3] Run CircleCI jobs in parallel Runs static checkers (ESlint, Flow) in parallel with web and native tests instead of sequentially --- .circleci/config.yml | 113 ++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 84de65228c..8fad05a4d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,38 @@ aliases: yarn cd ./mobile && yarn && yarn setup + - &install-rethinkdb + name: Install RethinkDB 2.3.5 + command: + | + echo "deb http://download.rethinkdb.com/apt jessie main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list + wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add - + sudo apt-get update + sudo apt-get install rethinkdb=2.3.5~0jessie + + - &start-rethinkdb + name: Start RethinkDB + command: rethinkdb --bind all + background: true + + - &setup-and-build-web + name: Setup and build + command: + | + node -e "const setup = require('./shared/testing/setup.js')().then(() => process.exit())" + yarn run build:web + yarn run build:iris + + - &start-iris + name: Start Iris in the background + command: TEST_DB=true yarn run dev:iris + background: true + + - &start-web + name: Start web client in the background + command: yarn run dev:web + background: true + defaults: &defaults working_directory: ~/spectrum @@ -51,16 +83,8 @@ jobs: root: . paths: . - # Tests js of the mobile app - test_mobile_js: - <<: *js_defaults - steps: - - attach_workspace: - at: ~/spectrum - - run: cd ./mobile && yarn test:unit - - # Test the web JS - test_web_js: + # Start db and servers, then run e2e and unit tests + test_web: <<: *defaults docker: - image: circleci/node:8-browsers @@ -71,41 +95,13 @@ jobs: steps: - attach_workspace: at: ~/spectrum - - run: - name: Install RethinkDB 2.3.5 - command: - | - echo "deb http://download.rethinkdb.com/apt jessie main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list - wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add - - sudo apt-get update - sudo apt-get install rethinkdb=2.3.5~0jessie - - run: - name: Start RethinkDB - command: rethinkdb --bind all - background: true + - run: *install-rethinkdb + - run: *start-rethinkdb - run: sleep 10 - - run: - name: Setup and build - command: - | - node -e "const setup = require('./shared/testing/setup.js')().then(() => process.exit())" - yarn run build:web - yarn run build:iris - - run: - name: Start Iris in the background - command: TEST_DB=true yarn run dev:iris - background: true - - run: - name: Start web client in the background - command: yarn run dev:web - background: true + - run: *setup-and-build-web + - run: *start-iris + - run: *start-web - run: sleep 60 - - run: - name: Run Flow - command: yarn run flow - - run: - name: Run ESLint - command: yarn run lint - run: name: Run Unit Tests command: yarn run test:ci @@ -117,6 +113,24 @@ jobs: when: always command: yarn run danger ci + # Run eslint, flow etc. + test_static_js: + <<: *js_defaults + steps: + - run: + name: Run Flow + command: yarn run flow + - run: + name: Run ESLint + command: yarn run lint + + # Tests js of the mobile app + test_mobile_js: + <<: *js_defaults + steps: + - attach_workspace: + at: ~/spectrum + - run: cd ./mobile && yarn test:unit # Tests native code of the mobile app test_mobile_native: @@ -148,8 +162,7 @@ jobs: workflows: version: 2 - # Tests mobile app - test_mobile: + test: jobs: - checkout_environment - test_mobile_js: @@ -159,11 +172,9 @@ workflows: # - test_mobile_native: # requires: # - checkout_environment - - # Tests web app - test_web: - jobs: - - checkout_environment - - test_web_js: + - test_web: + requires: + - checkout_environment + - test_static_js: requires: - checkout_environment From 9eb9efbb1aff5278702353b4829e5fcc3f309cdc Mon Sep 17 00:00:00 2001 From: Maximilian Stoiber Date: Mon, 19 Mar 2018 11:40:25 +0100 Subject: [PATCH 2/3] Fix attaching workspace --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8fad05a4d3..2dad02d4d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,6 +117,8 @@ jobs: test_static_js: <<: *js_defaults steps: + - attach_workspace: + at: ~/spectrum - run: name: Run Flow command: yarn run flow From 7eb29f86b5b428aff302f4996b73f4002ddc3a62 Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Mon, 19 Mar 2018 07:46:41 -0700 Subject: [PATCH 3/3] Small fixes to help danger pass 2.1.9 --- iris/models/user.js | 2 +- iris/mutations/message/addMessage.js | 2 +- src/components/chatInput/components/style.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iris/models/user.js b/iris/models/user.js index 4091d47fba..af1254e273 100644 --- a/iris/models/user.js +++ b/iris/models/user.js @@ -184,7 +184,7 @@ const createOrFindUser = ( }) .catch(err => { if (user.id) { - console.log(err); + console.error(err); return new Error(`No user found for id ${user.id}.`); } return storeUser(user); diff --git a/iris/mutations/message/addMessage.js b/iris/mutations/message/addMessage.js index d7ffd85129..17361e0d18 100644 --- a/iris/mutations/message/addMessage.js +++ b/iris/mutations/message/addMessage.js @@ -175,7 +175,7 @@ export default async ( }; }) .catch(err => { - console.log('Error sending message', err); + console.error('Error sending message', err); return new UserError('Error sending message, please try again'); }); }; diff --git a/src/components/chatInput/components/style.js b/src/components/chatInput/components/style.js index e82d2ec35e..6256d296e9 100644 --- a/src/components/chatInput/components/style.js +++ b/src/components/chatInput/components/style.js @@ -1,3 +1,4 @@ +// @flow import styled from 'styled-components'; import { zIndex } from 'src/components/globals';