From 3dbfebe92343d6fb8b128a3c88b5a49113cbed32 Mon Sep 17 00:00:00 2001
From: rschamp <rschamp@media.mit.edu>
Date: Mon, 23 Sep 2019 15:54:46 -0400
Subject: [PATCH] Parallelize

---
 .circleci/config.yml | 69 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 58 insertions(+), 11 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 24fcca76a..310c794f7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -44,23 +44,33 @@ aliases:
     working_directory: ~/repo
 
 jobs:
-  build:
+  setup:
     <<: *config_job_environment
-    environment:
-      NODE_ENV: production
-      JEST_JUNIT_OUTPUT_NAME: results.xml
     steps:
       - *step_restore_git_cache
       - checkout
       - *step_save_git_cache
-      - *step_restore_dependency_cache
-      - run: sudo npm install -g greenkeeper-lockfile
-      - run: npm --production=false install
-      - run: greenkeeper-lockfile-update
+      - run: npm ci
       - *step_save_dependency_cache
+  lint:
+    <<: *config_job_environment
+    steps:
+      - *step_restore_git_cache
+      - checkout
+      - *step_restore_dependency_cache
       - run:
           name: Lint
           command: npm run test:lint -- --quiet --output-file test-results/eslint/results.xml --format junit
+      - store_test_results:
+          path: test-results
+  unit:
+    <<: *config_job_environment
+    environment:
+      JEST_JUNIT_OUTPUT_NAME: results.xml
+    steps:
+      - *step_restore_git_cache
+      - checkout
+      - *step_restore_dependency_cache
       - run:
           name: Unit
           environment:
@@ -68,6 +78,17 @@ jobs:
           command: npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov
       - store_artifacts:
           path: coverage
+      - store_test_results:
+          path: test-results
+  build:
+    <<: *config_job_environment
+    environment:
+      NODE_ENV: production
+      NODE_OPTIONS: --max-old-space-size=4000
+    steps:
+      - *step_restore_git_cache
+      - checkout
+      - *step_restore_dependency_cache
       - run:
           name: Build
           command: npm run build
@@ -77,6 +98,15 @@ jobs:
           path: dist
       - *step_save_build_cache
       - *step_save_dist_cache
+  integration:
+    <<: *config_job_environment
+    environment:
+      JEST_JUNIT_OUTPUT_NAME: results.txt
+    steps:
+      - *step_restore_git_cache
+      - checkout
+      - *step_restore_dependency_cache
+      - *step_restore_build_cache
       - run:
           name: Integration
           environment:
@@ -84,7 +114,6 @@ jobs:
           command: npm run test:integration -- --reporters="default" --reporters="jest-junit"
       - store_test_results:
           path: test-results
-      - run: greenkeeper-lockfile-upload
 
   deploy-npm:
     <<: *config_job_environment
@@ -124,11 +153,26 @@ jobs:
       
 workflows:
   version: 2
-  build_and_deploy:
+  build-test-deploy:
     jobs:
-      - build
+      - setup
+      - lint:
+          requires:
+            - setup
+      - unit:
+          requires:
+            - setup
+      - build:
+          requires:
+            - setup
+      - integration:
+          requires:
+            - build
       - deploy-npm:
           requires:
+            - lint
+            - unit
+            - integration
             - build
           filters:
             branches:
@@ -139,4 +183,7 @@ workflows:
                 - /^hotfix\/.*/
       - deploy-gh-pages:
           requires:
+            - lint
+            - unit
+            - integration
             - build
-- 
GitLab