From 9c7f6affc2fd84a8b5ea0efdc55cf382e98d8795 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <codebytere@github.com>
Date: Mon, 7 Jan 2019 11:59:45 -0800
Subject: [PATCH] Revert "ci: use config version 2.1 on CircleCI (#15665)"
 (#16304)

This reverts commit 0c46a7a4d93408831baabab5e7e05589ad0604b7.
---
 .circleci/config.yml | 195 ++++++++++++++++++++++++-------------------
 1 file changed, 108 insertions(+), 87 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index fce9c6cc11d..8f6406bf08f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -7,31 +7,22 @@
 # CircleCI docs on variables:
 # https://circleci.com/docs/2.0/env-vars/
 
-version: 2.1
-
 # Build machines configs.
 docker-image: &docker-image
   docker:
     - image: electronbuilds/electron:0.0.9
 
-executors:
-  linux-medium:
-    <<: *docker-image
-    resource_class: medium
-    environment:
-      # Ninja misdetects a number of available CPUs.
-      NINJA_PARALLEL_JOBS: -j 3  # 2 CPUs + 1
+machine-linux-medium: &machine-linux-medium
+  <<: *docker-image
+  resource_class: medium
 
-  linux-2xlarge:
-    <<: *docker-image
-    resource_class: 2xlarge
-    environment:
-      # Ninja misdetects a number of available CPUs.
-      NINJA_PARALLEL_JOBS: -j 18  # 16 CPUs + 2
+machine-linux-2xlarge: &machine-linux-2xlarge
+  <<: *docker-image
+  resource_class: 2xlarge
 
-  mac:
-    macos:
-      xcode: "8.3.3"
+machine-mac: &machine-mac
+  macos:
+    xcode: "8.3.3"
 
 # Build configurations options.
 env-debug-build: &env-debug-build
@@ -178,7 +169,7 @@ step-electron-build: &step-electron-build
     name: Electron build
     command: |
       cd src
-      ninja -C out/Default electron $NINJA_PARALLEL_JOBS
+      ninja -C out/Default electron -j18
 
 step-maybe-electron-dist-strip: &step-maybe-electron-dist-strip
   run:
@@ -194,7 +185,7 @@ step-electron-dist-build: &step-electron-dist-build
     name: Build dist.zip
     command: |
       cd src
-      ninja -C out/Default electron:electron_dist_zip $NINJA_PARALLEL_JOBS
+      ninja -C out/Default electron:electron_dist_zip
 
 step-electron-dist-store: &step-electron-dist-store
   store_artifacts:
@@ -206,9 +197,11 @@ step-electron-chromedriver-build: &step-electron-chromedriver-build
     name: Build chromedriver.zip
     command: |
       cd src
-      ninja -C out/Default chrome/test/chromedriver $NINJA_PARALLEL_JOBS
+      # NOTE(alexeykuzmin): -j3 because chromedriver is currently built
+      # on a smaller size machine and ninja mis-detects the number of CPUs available.
+      ninja -C out/Default chrome/test/chromedriver -j3
       electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/out/Default/chromedriver
-      ninja -C out/Default electron:electron_chromedriver_zip $NINJA_PARALLEL_JOBS
+      ninja -C out/Default electron:electron_chromedriver_zip
 
 step-electron-chromedriver-store: &step-electron-chromedriver-store
   store_artifacts:
@@ -220,7 +213,7 @@ step-nodejs-headers-build: &step-nodejs-headers-build
     name: Build Node.js headers
     command: |
       cd src
-      ninja -C out/Default third_party/electron_node:headers $NINJA_PARALLEL_JOBS
+      ninja -C out/Default third_party/electron_node:headers
 
 step-nodejs-headers-store: &step-nodejs-headers-store
   store_artifacts:
@@ -281,7 +274,9 @@ step-ffmpeg-build: &step-ffmpeg-build
     name: Non proprietary ffmpeg build
     command: |
       cd src
-      ninja -C out/ffmpeg electron:electron_ffmpeg_zip $NINJA_PARALLEL_JOBS
+      # NOTE(jeremy): -j3 because ffmpeg is currently built on a smaller
+      # machine size and ninja mis-detects the number of CPUs available.
+      ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j3
 
 step-verify-ffmpeg: &step-verify-ffmpeg
   run:
@@ -332,7 +327,9 @@ step-mksnapshot-build: &step-mksnapshot-build
           electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot
         fi
       fi
-      ninja -C out/Default electron:electron_mksnapshot_zip $NINJA_PARALLEL_JOBS
+      # NOTE(jeremy): -j3 because mksnapshot is currently built on a smaller
+      # machine size and ninja mis-detects the number of CPUs available.
+      ninja -C out/Default electron:electron_mksnapshot_zip -j3
 
 step-mksnapshot-store: &step-mksnapshot-store
   store_artifacts:
@@ -345,7 +342,7 @@ step-build-dump-syms: &step-build-dump-syms
     command: |
       cd src
       # Build needed dump_syms executable
-      ninja -C out/Default third_party/breakpad:dump_syms $NINJA_PARALLEL_JOBS
+      ninja -C out/Default third_party/breakpad:dump_syms
 
 step-generate-breakpad-symbols: &step-generate-breakpad-symbols
   run:
@@ -381,7 +378,9 @@ step-maybe-native-mksnapshot-build: &step-maybe-native-mksnapshot-build
     command: |
       if [ "$BUILD_NATIVE_MKSNAPSHOT" == "1" ]; then
         cd src
-        ninja -C out/native_mksnapshot electron:electron_mksnapshot_zip $NINJA_PARALLEL_JOBS
+        # NOTE(jeremy): -j3 because mksnapshot is currently built on a smaller
+        # machine size and ninja mis-detects the number of CPUs available.
+        ninja -C out/native_mksnapshot electron:electron_mksnapshot_zip -j3
       else
         echo 'Skipping native mksnapshot build for non arm build'
       fi
@@ -619,7 +618,7 @@ steps-native-tests: &steps-native-tests
         name: Build tests
         command: |
           cd src
-          ninja -C out/Default $BUILD_TARGET $NINJA_PARALLEL_JOBS
+          ninja -C out/Default $BUILD_TARGET
     - *step-show-sccache-stats
 
     - *step-setup-linux-for-headless-testing
@@ -760,50 +759,51 @@ chromium-upgrade-branches: &chromium-upgrade-branches
   /chromium\-upgrade\/[0-9]+/
 
 # List of all jobs.
+version: 2
 jobs:
   # Layer 1: Checkout.
   linux-checkout:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
     <<: *steps-checkout
 
   linux-checkout-for-native-tests:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       GCLIENT_EXTRA_ARGS: '--custom-var=checkout_pyyaml=True'
     <<: *steps-checkout
 
   linux-checkout-for-native-tests-with-no-patches:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       GCLIENT_EXTRA_ARGS: '--custom-var=apply_patches=False --custom-var=checkout_pyyaml=True'
     <<: *steps-checkout
 
   # Layer 2: Builds.
   linux-x64-debug:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-debug-build
       <<: *env-enable-sccache
     <<: *steps-electron-build
 
   linux-x64-testing:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-testing-build
       <<: *env-enable-sccache
     <<: *steps-electron-build-for-tests
 
   linux-x64-ffmpeg:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-enable-sccache
       <<: *env-send-slack-notifications
     <<: *steps-ffmpeg-build
 
   linux-x64-chromedriver:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-release-build
       <<: *env-enable-sccache
@@ -811,7 +811,7 @@ jobs:
     <<: *steps-chromedriver-build
 
   linux-x64-release:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-release-build
       <<: *env-enable-sccache
@@ -819,14 +819,14 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-x64-publish:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
       <<: *env-release-build
     <<: *steps-electron-build-for-publish
 
   linux-ia32-debug:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-ia32
       <<: *env-debug-build
@@ -834,7 +834,7 @@ jobs:
     <<: *steps-electron-build
 
   linux-ia32-testing:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-ia32
       <<: *env-testing-build
@@ -842,7 +842,7 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-ia32-ffmpeg:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-ia32
       <<: *env-enable-sccache
@@ -850,7 +850,7 @@ jobs:
     <<: *steps-ffmpeg-build
 
   linux-ia32-chromedriver:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-ia32
       <<: *env-release-build
@@ -859,7 +859,7 @@ jobs:
     <<: *steps-chromedriver-build
 
   linux-ia32-release:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-ia32
       <<: *env-release-build
@@ -868,7 +868,7 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-ia32-publish:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
       <<: *env-ia32
@@ -876,7 +876,7 @@ jobs:
     <<: *steps-electron-build-for-publish
 
   linux-arm-debug:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm
       <<: *env-debug-build
@@ -884,7 +884,7 @@ jobs:
     <<: *steps-electron-build
 
   linux-arm-testing:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm
       <<: *env-testing-build
@@ -893,7 +893,7 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-arm-ffmpeg:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-arm
       <<: *env-enable-sccache
@@ -901,7 +901,7 @@ jobs:
     <<: *steps-ffmpeg-build
 
   linux-arm-chromedriver:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-arm
       <<: *env-release-build
@@ -910,7 +910,7 @@ jobs:
     <<: *steps-chromedriver-build
 
   linux-arm-release:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm
       <<: *env-release-build
@@ -919,7 +919,7 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-arm-publish:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm
       <<: *env-release-build
@@ -927,7 +927,7 @@ jobs:
     <<: *steps-electron-build-for-publish
 
   linux-arm-native-mksnapshot:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-arm
       <<: *env-release-build
@@ -936,7 +936,7 @@ jobs:
     <<: *steps-native-mksnapshot-build
 
   linux-arm64-debug:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm64
       <<: *env-debug-build
@@ -944,7 +944,7 @@ jobs:
     <<: *steps-electron-build
 
   linux-arm64-testing:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm64
       <<: *env-testing-build
@@ -953,7 +953,7 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-arm64-ffmpeg:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-arm64
       <<: *env-enable-sccache
@@ -961,7 +961,7 @@ jobs:
     <<: *steps-ffmpeg-build
 
   linux-arm64-chromedriver:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-arm64
       <<: *env-release-build
@@ -970,7 +970,7 @@ jobs:
     <<: *steps-chromedriver-build
 
   linux-arm64-release:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm64
       <<: *env-release-build
@@ -979,7 +979,7 @@ jobs:
     <<: *steps-electron-build-for-tests
 
   linux-arm64-publish:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-arm64
       <<: *env-release-build
@@ -987,7 +987,7 @@ jobs:
     <<: *steps-electron-build-for-publish
 
   linux-arm64-native-mksnapshot:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-arm64
       <<: *env-release-build
@@ -996,14 +996,14 @@ jobs:
     <<: *steps-native-mksnapshot-build
 
   osx-testing:
-    executor: mac
+    <<: *machine-mac
     environment:
       <<: *env-testing-build
       <<: *env-enable-sccache
     <<: *steps-build-mac
 
   mas-testing:
-    executor: mac
+    <<: *machine-mac
     environment:
       <<: *env-mas
       <<: *env-testing-build
@@ -1012,7 +1012,7 @@ jobs:
 
   # Layer 3: Tests.
   linux-x64-unittests:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-unittests
       <<: *env-enable-sccache
@@ -1020,7 +1020,7 @@ jobs:
     <<: *steps-native-tests
 
   linux-x64-disabled-unittests:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-unittests
       <<: *env-enable-sccache
@@ -1029,7 +1029,7 @@ jobs:
     <<: *steps-native-tests
 
   linux-x64-chromium-unittests:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-unittests
       <<: *env-enable-sccache
@@ -1038,7 +1038,7 @@ jobs:
     <<: *steps-native-tests
 
   linux-x64-browsertests:
-    executor: linux-2xlarge
+    <<: *machine-linux-2xlarge
     environment:
       <<: *env-browsertests
       <<: *env-testing-build
@@ -1047,35 +1047,35 @@ jobs:
     <<: *steps-native-tests
 
   linux-x64-testing-tests:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-headless-testing
       <<: *env-stack-dumping
     <<: *steps-tests
 
   linux-x64-release-tests:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-headless-testing
       <<: *env-send-slack-notifications
     <<: *steps-tests
 
   linux-x64-verify-ffmpeg:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-headless-testing
       <<: *env-send-slack-notifications
     <<: *steps-verify-ffmpeg
 
   linux-x64-verify-mksnapshot:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-headless-testing
       <<: *env-send-slack-notifications
     <<: *steps-verify-mksnapshot
 
   linux-ia32-testing-tests:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-ia32
       <<: *env-headless-testing
@@ -1083,7 +1083,7 @@ jobs:
     <<: *steps-tests
 
   linux-ia32-release-tests:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-ia32
       <<: *env-headless-testing
@@ -1091,7 +1091,7 @@ jobs:
     <<: *steps-tests
 
   linux-ia32-verify-ffmpeg:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-ia32
       <<: *env-headless-testing
@@ -1099,22 +1099,49 @@ jobs:
     <<: *steps-verify-ffmpeg
 
   linux-ia32-verify-mksnapshot:
-    executor: linux-medium
+    <<: *machine-linux-medium
     environment:
       <<: *env-ia32
       <<: *env-headless-testing
       <<: *env-send-slack-notifications
     <<: *steps-verify-mksnapshot
 
-  mac-tests:
-    executor: mac
+  osx-testing-tests:
+    <<: *machine-mac
+    environment:
+      <<: *env-stack-dumping
+    <<: *steps-tests
+
+  mas-testing-tests:
+    <<: *machine-mac
     environment:
       <<: *env-stack-dumping
     <<: *steps-tests
 
   # Layer 4: Summary.
-  linux-release-summary:
-    executor: linux-medium
+  linux-x64-release-summary:
+    <<: *machine-linux-medium
+    environment:
+      - *env-send-slack-notifications
+    steps:
+      - *step-maybe-notify-slack-success
+
+  linux-ia32-release-summary:
+    <<: *machine-linux-medium
+    environment:
+      - *env-send-slack-notifications
+    steps:
+      - *step-maybe-notify-slack-success
+
+  linux-arm-release-summary:
+    <<: *machine-linux-medium
+    environment:
+      - *env-send-slack-notifications
+    steps:
+      - *step-maybe-notify-slack-success
+
+  linux-arm64-release-summary:
+    <<: *machine-linux-medium
     environment:
       - *env-send-slack-notifications
     steps:
@@ -1164,16 +1191,14 @@ workflows:
     jobs:
       - osx-testing:
          <<: *filter-only-prs-from-forks
-      - mac-tests:
-          name: osx-testing-tests
+      - osx-testing-tests:
           <<: *filter-only-prs-from-forks
           requires:
             - osx-testing
 
       - mas-testing:
           <<: *filter-only-prs-from-forks
-      - mac-tests:
-          name: mas-testing-tests
+      - mas-testing-tests:
           <<: *filter-only-prs-from-forks
           requires:
             - mas-testing
@@ -1209,8 +1234,7 @@ workflows:
       - linux-x64-chromedriver:
           requires:
             - linux-checkout
-      - linux-release-summary:
-          name: linux-x64-release-summary
+      - linux-x64-release-summary:
           requires:
             - linux-x64-release
             - linux-x64-release-tests
@@ -1237,8 +1261,7 @@ workflows:
       - linux-ia32-chromedriver:
           requires:
             - linux-checkout
-      - linux-release-summary:
-          name: linux-ia32-release-summary
+      - linux-ia32-release-summary:
           requires:
             - linux-ia32-release
             - linux-ia32-release-tests
@@ -1258,8 +1281,7 @@ workflows:
       - linux-arm-chromedriver:
           requires:
             - linux-checkout
-      - linux-release-summary:
-          name: linux-arm-release-summary
+      - linux-arm-release-summary:
           requires:
             - linux-arm-release
             - linux-arm-ffmpeg
@@ -1278,8 +1300,7 @@ workflows:
       - linux-arm64-chromedriver:
           requires:
             - linux-checkout
-      - linux-release-summary:
-          name: linux-arm64-release-summary
+      - linux-arm64-release-summary:
           requires:
             - linux-arm64-release
             - linux-arm64-ffmpeg