From 91f07b9d99e8c7fd0629509c1ab1e4f2fe13fa96 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Tue, 10 Oct 2017 08:47:46 +0200 Subject: [PATCH] CircleCI cache fix (#3329) * Update luarocks/shellcheck/shfmt check based on `deps-{{ arch }}-{{ checksum ".ci/install.sh" }}` * We generate a git-rev-base to check whether we can trust the cache with `build-{{ arch }}-{{ checksum "git-rev-base" }}` Binary dependencies require `{{ arch }}` because there are different CPUs used on the servers. More information here: https://discuss.circleci.com/t/use-the-arch-cache-template-key-if-you-rely-on-cached-compiled-binary-dependencies/16129 --- .ci/install.sh | 2 +- .circleci/config.yml | 16 +++++++++++----- .gitignore | 1 + base | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.ci/install.sh b/.ci/install.sh index e199c73a4..5f30d27b2 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -13,7 +13,7 @@ ls # if [ "$(git status --ignore-submodules=dirty --porcelain)" ]; then # "--ignore-submodules=dirty", removed temporarily, as it did not notice as # expected that base was updated and kept using old cached base -if [ "$(git status --porcelain)" ]; then +if [ "$(git status --ignore-submodules=dirty --porcelain)" ]; then # what changed? git status # purge and reinit submodules diff --git a/.circleci/config.yml b/.circleci/config.yml index c6573922c..e81ff338f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,10 +11,16 @@ jobs: - checkout - restore_cache: keys: - - deps - - build + # binary dependencies require {{ arch }} because there are different CPUs in use on the servers + - deps-{{ arch }}-{{ checksum ".ci/install.sh" }} + # need to init some stuff first or git will complain when sticking in base cache + - run: git submodule init base && git submodule update base && pushd base && git submodule init && git submodule update && popd + # we can't use command output directly for cache check so we write it to git-rev-base + - run: pushd base && git_rev_base=$(git describe HEAD) && popd && echo $git_rev_base && echo $git_rev_base >git-rev-base + - restore_cache: + keys: + - build-{{ arch }}-{{ checksum "git-rev-base" }} - run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV - - run: name: setup command: .ci/before_install.sh @@ -41,12 +47,12 @@ jobs: name: clean up cache command: rm -frv ./base/build/*/{spec,cache/*} - save_cache: - key: build + key: build-{{ arch }}-{{ checksum "git-rev-base" }} paths: - "/home/ko/.ccache" - "base" - save_cache: - key: deps + key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} paths: - "/home/ko/bin" - "/home/ko/.luarocks" diff --git a/.gitignore b/.gitignore index ca04702a2..93abb1704 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ install/ spec/unit/data doc/html git-rev +git-rev-base emu luacov.stats.out trace-out.txt diff --git a/base b/base index 2148066d5..a7b3508f9 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 2148066d59205f09d60f0bbaad256526b4b309d7 +Subproject commit a7b3508f9ffefe062db78a4797119041e24058c3