2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

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
This commit is contained in:
Frans de Jonge 2017-10-10 08:47:46 +02:00 committed by GitHub
parent 66e521f34b
commit 91f07b9d99
4 changed files with 14 additions and 7 deletions

View File

@ -13,7 +13,7 @@ ls
# if [ "$(git status --ignore-submodules=dirty --porcelain)" ]; then # if [ "$(git status --ignore-submodules=dirty --porcelain)" ]; then
# "--ignore-submodules=dirty", removed temporarily, as it did not notice as # "--ignore-submodules=dirty", removed temporarily, as it did not notice as
# expected that base was updated and kept using old cached base # 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? # what changed?
git status git status
# purge and reinit submodules # purge and reinit submodules

View File

@ -11,10 +11,16 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- deps # binary dependencies require {{ arch }} because there are different CPUs in use on the servers
- build - 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: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV
- run: - run:
name: setup name: setup
command: .ci/before_install.sh command: .ci/before_install.sh
@ -41,12 +47,12 @@ jobs:
name: clean up cache name: clean up cache
command: rm -frv ./base/build/*/{spec,cache/*} command: rm -frv ./base/build/*/{spec,cache/*}
- save_cache: - save_cache:
key: build key: build-{{ arch }}-{{ checksum "git-rev-base" }}
paths: paths:
- "/home/ko/.ccache" - "/home/ko/.ccache"
- "base" - "base"
- save_cache: - save_cache:
key: deps key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }}
paths: paths:
- "/home/ko/bin" - "/home/ko/bin"
- "/home/ko/.luarocks" - "/home/ko/.luarocks"

1
.gitignore vendored
View File

@ -17,6 +17,7 @@ install/
spec/unit/data spec/unit/data
doc/html doc/html
git-rev git-rev
git-rev-base
emu emu
luacov.stats.out luacov.stats.out
trace-out.txt trace-out.txt

2
base

@ -1 +1 @@
Subproject commit 2148066d59205f09d60f0bbaad256526b4b309d7 Subproject commit a7b3508f9ffefe062db78a4797119041e24058c3