Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit 3b47c38

Browse files
authored
Merge pull request #568 from bytecodealliance/acf/smaller-caches
📉 Reduce CircleCI cache sizes by keying on `rust-toolchain`
2 parents 83ad8b3 + 08dc00d commit 3b47c38

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

.circleci/config.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,15 @@ commands:
9595
# 2. A Linux cache built on a matching branch name with any `Cargo.lock` checksum
9696
# 3. Any Linux cache
9797
#
98+
# We only restore caches from matching `rust-toolchain` versions, so that we don't
99+
# accumulate multiple versions of build artifacts over time.
100+
#
98101
# The hope is that even if some of the dependencies change between branches and
99102
# revisions, that enough of the slow-changing dependencies will remain static that
100103
# Cargo won't have to rebuild them.
101-
- target_dir-linux-{{ .Branch }}-{{ checksum "Cargo.lock" }}
102-
- target_dir-linux-{{ .Branch }}-
103-
- target_dir-linux-
104+
- target_dir-{{ .Environment.CACHE_VERSION }}-linux-{{ checksum "rust-toolchain" }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
105+
- target_dir-{{ .Environment.CACHE_VERSION }}-linux-{{ checksum "rust-toolchain" }}-{{ .Branch }}-
106+
- target_dir-{{ .Environment.CACHE_VERSION }}-linux-{{ checksum "rust-toolchain" }}-
104107
- build_container
105108
- make_in_container:
106109
target: test-full
@@ -111,7 +114,7 @@ commands:
111114
condition: << parameters.cache_target >>
112115
steps:
113116
- save_cache:
114-
key: target_dir-linux-{{ .Branch }}-{{ checksum "Cargo.lock" }}
117+
key: target_dir-{{ .Environment.CACHE_VERSION }}-linux-{{ checksum "rust-toolchain" }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
115118
paths:
116119
- "target"
117120

@@ -141,12 +144,15 @@ commands:
141144
# 2. A macOS cache built on a matching branch name with any `Cargo.lock` checksum
142145
# 3. Any macOS cache
143146
#
147+
# We only restore caches from matching `rust-toolchain` versions, so that we don't
148+
# accumulate multiple versions of build artifacts over time.
149+
#
144150
# The hope is that even if some of the dependencies change between branches and
145151
# revisions, that enough of the slow-changing dependencies will remain static that
146152
# Cargo won't have to rebuild them.
147-
- target_dir-macos-{{ .Branch }}-{{ checksum "Cargo.lock" }}-{{ .Environment.CACHE_VERSION }}
148-
- target_dir-macos-{{ .Branch }}-{{ .Environment.CACHE_VERSION }}
149-
- target_dir-macos-{{ .Environment.CACHE_VERSION }}
153+
- target_dir-{{ .Environment.CACHE_VERSION }}-macos-{{ checksum "rust-toolchain" }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
154+
- target_dir-{{ .Environment.CACHE_VERSION }}-macos-{{ checksum "rust-toolchain" }}-{{ .Branch }}-
155+
- target_dir-{{ .Environment.CACHE_VERSION }}-macos-{{ checksum "rust-toolchain" }}-
150156
- run:
151157
name: "Install Homebrew dependencies"
152158
command: |
@@ -181,7 +187,7 @@ commands:
181187
condition: << parameters.cache_target >>
182188
steps:
183189
- save_cache:
184-
key: target_dir-macos-{{ .Branch }}-{{ checksum "Cargo.lock" }}-{{ .Environment.CACHE_VERSION }}
190+
key: target_dir-{{ .Environment.CACHE_VERSION }}-macos-{{ checksum "rust-toolchain" }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
185191
paths:
186192
- "target"
187193

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ test-ci: test-packages test-objdump test-bitrot test-signature test-objdump
4747

4848
.PHONY: test-bitrot
4949
test-bitrot:
50-
# check but do *not* build or run these packages to mitigate bitrot
51-
cargo check -p lucet-spectest -p lucet-runtime-example
50+
# build but do *not* run these packages to mitigate bitrot
51+
cargo build -p lucet-spectest -p lucet-runtime-example
5252

5353
.PHONY: test-signature
5454
test-signature:

0 commit comments

Comments
 (0)