From 76bc70e50bf0c7b024a3039df6fa722973b7217f Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Mar 2018 14:27:01 -0400 Subject: [PATCH] ENH: Update CircleCI external data cache Introduce Yaml anchors to enable reuse of common steps. The previous external data circleci cache was never being updated. Obtain the most recent commit to modify a md5 or sha512 file. The hash of this commit message is used for the hash key of the external data CircleCI cache. Change-Id: I29e35b15bfd3c3d2799ce835bd4a8dedd371f49a --- .circleci/config.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 157442ca824..a6abacdf32a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,3 +1,16 @@ +referenced: + generate-hash-step: &generate-hash-step + run: + name: Generate external data hash + command: | + cd ITK + find . -name \*.md5 -o -name \*.sha512 -print0 | xargs -d "\n" git log -n 1 | tee /home/circleci/external-data.hashable + restore-data-step: &restore-data-step + restore_cache: + keys: + - 'v1-external-data-{{ checksum "/home/circleci/external-data.hashable" }}' + - 'v1-external-data' + version: 2 jobs: build: @@ -19,9 +32,8 @@ jobs: steps: - checkout: path : ~/ITK - - restore_cache: - keys: - - external-data + - *generate-hash-step + - *restore-data-step - restore_cache: keys: - ccache-{{ arch }}-{{ .Branch }} @@ -78,5 +90,5 @@ jobs: key: 'ccache-{{ arch }}-{{ .Branch }}-{{ epoch }}' paths: [ "/home/circleci/.ccache" ] - save_cache: - key: 'external-data' + key: 'v1-external-data-{{ checksum "/home/circleci/external-data.hashable" }}' paths: [ "/home/circleci/.ExternalData" ]