diff --git a/.circleci/config.yml b/.circleci/config.yml index c597797d3..0a0d96531 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,14 +11,29 @@ jobs: apt install -y build-essential zlib1g-dev uuid-dev libdigest-sha-perl libelf-dev bc bzip2 bison flex git gnupg iasl m4 nasm patch python wget gnat cpio ccache pkg-config cmake libusb-1.0-0-dev autoconf texinfo ncurses-dev - checkout - - restore_cache: - key: heads-{{ .Environment.CIRCLE_USERNAME }}-{{ .Environment.CACHE_VERSION }} - - run: name: git reset command: | git reset --hard "$CIRCLE_SHA1" \ + - run: + name: Creating all modules and patches digest + command: | + find ./patches/ ./modules/ -type f | sort -h |xargs sha256sum > /tmp/all_modules_and_patches.sha256sums \ + + - run: + name: Creating musl-cross-make and musl-cross-make patches digest + command: | + find ./patches/musl-cross-* modules/musl-cross* -type f | sort -h | xargs sha256sum > /tmp/musl-cross_module_and_patches.sha256sums \ + + + - restore_cache: + keys: + #Restore existing cache for modules checksums validated to be exactly the same as in github current commit + - heads-modules-and-patches-{{ checksum "/tmp/all_modules_and_patches.sha256sums" }} + #If precedent fails. Restore cache for musl-cross module checksum validated to be exactly the same as in github current commit + - heads-cross-musl-{{ checksum "/tmp/musl-cross_module_and_patches.sha256sums" }} + # linuxboot steps need something to pass in the kernel header path # skipping for now # - run: @@ -153,12 +168,19 @@ jobs: path: build/qemu-coreboot - save_cache: - key: heads-{{ .Environment.CIRCLE_USERNAME }}-{{ .Environment.CACHE_VERSION }} + #Generate cache for the same musl-cross module definition if hash is not previously existing + key: heads-cross-musl-{{ checksum "/tmp/musl-cross_module_and_patches.sha256sums" }} + paths: + - crossgcc + - build/musl-cross-* + + - save_cache: + #Generate cache for the exact same modules definitions if hash is not previously existing + key: heads-modules-and-patches-{{ checksum "/tmp/all_modules_and_patches.sha256sums" }} paths: - packages - crossgcc - build - workflows: version: 2 build_and_test: