From acb50344e8b913249e10f8cc39eb99071205b6c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Hedenstro=CC=88m?= <erik@hedenstroem.com>
Date: Wed, 15 Jun 2016 12:44:54 +0200
Subject: [PATCH] Tweaked rebar caching

---
 .gitignore     |  1 +
 .gitlab-ci.yml | 10 +++++++---
 rebar.config   |  5 ++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index f710fdd..f3682eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 doc
 _build
+.rebar3
 rebar3
 rebar.lock
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bebaf39..16fef45 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,9 @@
+cache:
+  paths:
+    - .rebar3
+
 before_script:
-  - rebar3 update
+  - export PATH=${ERL_HOME}/bin:$PATH
 
 stages:
   - compile
@@ -9,6 +13,7 @@ stages:
 compile:
   stage: compile
   script:
+    - rebar3 update
     - rebar3 as production do compile
 
 test:
@@ -23,10 +28,9 @@ hex_publish:
     - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
   script:
     - mkdir -p ~/.hex && printf "{key,<<\"$HEX_KEY\">>}.\n{username,<<\"$HEX_USERNAME\">>}.\n" > ~/.hex/hex.config
-    - mkdir -p ~/.config/rebar3 && printf "{plugins, [rebar3_hex]}.\n" > ~/.config/rebar3/rebar.config
     - echo "Y" | rebar3 hex publish
 
-aws_publish:
+aws_s3:
   stage: publish
   only:
     - /^\d+[.]\d+[.]\d+$/ # Only publish HEAD tagged with semantic version
diff --git a/rebar.config b/rebar.config
index 7074cce..e884fbe 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,3 +1,7 @@
+{global_rebar_dir, ".rebar3"}.
+
+{plugins, [rebar3_hex]}.
+
 {relx, [
     {release, {gurka, semver}, [gurka]},
     {dev_mode, true},
@@ -23,4 +27,3 @@
         {erl_opts, [no_debug_info, warnings_as_errors]}
     ]}
 ]}.
-
-- 
GitLab