From 0ebe045b89989ad42b401bdbf111eb8ae56a9021 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 11 Sep 2019 14:02:43 -0400
Subject: [PATCH] save the stack cache earlier

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

diff --git a/.circleci/config.yml b/.circleci/config.yml
index f143df3..c587983 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -92,6 +92,17 @@ jobs:
           # while to build.
           no_output_timeout: "20m"
 
+      - save_cache:
+          # We can save the stack cache right here.  It will have everything
+          # we want in it now that the dependencies have been built.  And this
+          # way we get to save the cache whether or not the test suite goes on
+          # to succeed.
+          name: "Cache Dependencies"
+          key: paymentserver-v1-{{ checksum "stack.yaml" }}-{{ checksum "PaymentServer.cabal" }}
+          paths:
+            - "/root/.stack"
+            - ".stack-work"
+
       - run:
           name: "Run Tests"
           command: |
@@ -125,13 +136,6 @@ jobs:
               --no-haddock-deps"
             nix-shell shell.nix --run "$BUILD"
 
-      - save_cache:
-          name: "Cache Dependencies"
-          key: paymentserver-v1-{{ checksum "stack.yaml" }}-{{ checksum "PaymentServer.cabal" }}
-          paths:
-            - "/root/.stack"
-            - ".stack-work"
-
       - save_cache:
           name: "Cache Nix Store Paths"
           key: paymentserver-nix-store-v1-{{ .Environment.NIXPKGS_REV }}
-- 
GitLab