From 4e5935e4a9aeaa06bbca6dbc1e12c82530ce984a Mon Sep 17 00:00:00 2001
From: Tom Robinson <tlrobinson@gmail.com>
Date: Wed, 28 Sep 2016 07:24:59 -0700
Subject: [PATCH] time each ci step [ci drivers] [ci e2e] [ci
 compare_screenshots]

---
 bin/ci                  | 50 ++++++++++++++++++++++++++++-------------
 bin/compare-screenshots |  2 +-
 2 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/bin/ci b/bin/ci
index a8d65ebd2fc..b6f8750f01c 100755
--- a/bin/ci
+++ b/bin/ci
@@ -41,6 +41,25 @@ is_engine_enabled() {
     [[ "$ENGINES" == *"$1"* ]]
 }
 
+# print a summary on exit
+results=""
+summary() {
+    echo -e "========================================"
+    echo -en "$results"
+    echo -e "========================================"
+}
+trap summary EXIT
+
+# records the time and exit code of each step
+run_step() {
+    status=0
+    start=$(date +%s)
+    "$@" || status=$?
+    elapsed=$(expr $(date +%s) - $start || true)
+    results="${results}status=$status time=$elapsed command=$@\n"
+    return $status
+}
+
 # default engines
 export ENGINES="h2"
 
@@ -49,44 +68,45 @@ case $CIRCLE_NODE_INDEX in
             export ENGINES="h2,mongo,mysql,bigquery";
         fi
         if is_engine_enabled "mongo"; then
-            install-mongodb;
+            run_step install-mongodb;
         fi
-        lein test
+        run_step lein test
         ;;
     1)  if is_enabled "drivers"; then
             export ENGINES="h2,sqlserver,oracle";
         fi
         MB_DB_TYPE=postgres MB_DB_DBNAME=circle_test MB_DB_PORT=5432 MB_DB_USER=ubuntu MB_DB_HOST=localhost \
-            lein test
+            run_step lein test
         ;;
     2)  if is_enabled "drivers"; then
             export ENGINES="h2,postgres,sqlite,crate";
         fi
         if is_engine_enabled "crate"; then
-            install-crate;
+            run_step install-crate;
         fi
         MB_DB_TYPE=mysql MB_DB_DBNAME=circle_test MB_DB_PORT=3306 MB_DB_USER=ubuntu MB_DB_HOST=localhost \
-            lein test
+            run_step lein test
         ;;
     3)  if is_enabled "drivers"; then
             export ENGINES="h2,redshift,druid";
         fi
-        lein test
+        run_step lein test
         ;;
-    4)  lein eastwood
-        lein bikeshed
-        lein docstring-checker
-        ./bin/reflection-linter
+    4)  run_step lein eastwood
+        run_step lein bikeshed
+        run_step lein docstring-checker
+        run_step ./bin/reflection-linter
         ;;
-    5)  npm run lint
-        npm run test
+    5)  run_step npm run lint
+        run_step npm run test
         ;;
-    6)  ./bin/build version frontend sample-dataset uberjar
+    6)  run_step ./bin/build version frontend sample-dataset uberjar
         if is_enabled "e2e" || is_enabled "compare_screenshots"; then
-            USE_SAUCE=true npm run test-e2e
+            USE_SAUCE=true \
+                run_step npm run test-e2e
         fi
         if is_enabled "compare_screenshots"; then
-            node_modules/.bin/babel-node ./bin/compare-screenshots
+            run_step node_modules/.bin/babel-node ./bin/compare-screenshots
         fi
         ;;
 esac
diff --git a/bin/compare-screenshots b/bin/compare-screenshots
index 463b547f11e..4f7e2535a48 100755
--- a/bin/compare-screenshots
+++ b/bin/compare-screenshots
@@ -14,7 +14,7 @@ const SLACK_TOKEN = process.env["SLACK_TOKEN"];
 const SLACK_CHANNEL = "#ci-screenshots";
 
 const CIRCLE_PROJECT = "github/metabase/metabase";
-const CIRCLE_BRANCH = "new-e2e-test-setup";
+const CIRCLE_BRANCH = "master";
 
 const CIRCLE_SCREENSHOT_PATH = "/home/ubuntu/metabase/screenshots/";
 
-- 
GitLab