gitlab-ci: Use a shared ccache for the runners
authorAndreas Schneider <asn@samba.org>
Sun, 29 Mar 2020 15:20:32 +0000 (17:20 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 1 Apr 2020 07:25:33 +0000 (07:25 +0000)
https://docs.gitlab.com/ee/ci/caching/

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Apr  1 07:25:33 UTC 2020 on sn-devel-184

.gitlab-ci.yml

index 12b76028aa5ffcbb8f82bbd42e8e39b336245320..27a8dea47c185bc542c3b7ffcda8edf1878a3476 100644 (file)
@@ -58,6 +58,10 @@ include:
   tags:
     - docker
     - shared
+  cache:
+    key: ccache.${CI_JOB_NAME}
+    paths:
+      - ccache
   before_script:
     - uname -a
     - lsb_release -a
@@ -76,11 +80,18 @@ include:
     - echo "${SAMBA_CI_CONTAINER_TAG}" > /tmp/sha1sum-tag.txt
     - diff -u bootstrap/sha1sum.txt /tmp/sha1sum-tag.txt
     - diff -u bootstrap/sha1sum.txt /sha1sum.txt
+    - export CCACHE_BASEDIR="${PWD}"
+    - export CCACHE_DIR="${PWD}/ccache" && mkdir -pv "$CCACHE_DIR"
+    - export CC="ccache cc"
+    - export CXX="ccache c++"
+    - ccache -z -M 500M
+    - ccache -s
   after_script:
     - mount
     - df -h
     - cat /proc/swaps
     - free -h
+    - CCACHE_BASEDIR="${PWD}" CCACHE_DIR="${PWD}/ccache" ccache -s -c
   artifacts:
     expire_in: 1 week
     paths: