Skip to content

Commit 39e9d43

Browse files
committed
ci: store cargo and yarn cache mounts
1 parent a333049 commit 39e9d43

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

.github/actions/docker/action.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,63 @@ runs:
9292
# name: ${{ inputs.image_name }}
9393
# bucket: ${{ inputs.bucket }}
9494

95+
RUN --mount=type=cache,sharing=shared,id=,target=${CARGO_HOME}/registry/index \
96+
--mount=type=cache,sharing=shared,id=cargo_registry_cache,target=${CARGO_HOME}/registry/cache \
97+
--mount=type=cache,sharing=shared,id=cargo_git,target=${CARGO_HOME}/git/db \
98+
99+
- name: Cargo cache for Docker
100+
uses: actions/cache@v4
101+
id: cargo-cache
102+
with:
103+
path: |
104+
../cargo-cache-registry-index
105+
../cargo-cache-registry-cache
106+
../cargo-cache-git-db
107+
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
108+
restore-keys:
109+
- ${{ runner.os }}-cargo-
110+
111+
- name: Inject cargo cache into docker
112+
uses: reproducible-containers/buildkit-cache-dance@3
113+
with:
114+
cache-map: |
115+
{
116+
"../cargo-cache-registry-index": {
117+
"target": "/root/.cargo/registry/index",
118+
"id": "cargo_registry_index"
119+
},
120+
"../cargo-cache-registry-cache": {
121+
"target": "/root/.cargo/registry/cache",
122+
"id": "cargo_registry_index"
123+
},
124+
"../cargo-cache-git-db": {
125+
"target": "/root/.cargo/git/db",
126+
"id": "cargo_registry_index"
127+
},
128+
}
129+
skip-extraction: ${{ steps.cargo-cache.outputs.cache-hit }}
130+
131+
- name: Yarn unplugged cache for Docker
132+
uses: actions/cache@v4
133+
id: yarn-cache
134+
with:
135+
path: ../yarn-unplugged-cache
136+
key: ${{ runner.os }}-yarn-unplugged-amd64-${{ hashFiles('yarn.lock') }}
137+
restore-keys:
138+
- ${{ runner.os }}-yarn-unplugged-amd64-
139+
140+
- name: Inject cargo cache into docker
141+
uses: reproducible-containers/buildkit-cache-dance@3
142+
with:
143+
cache-map: |
144+
{
145+
"../yarn-unplugged-cache": {
146+
"target": "/tmp/unplugged",
147+
"id": "unplugged_amd64"
148+
},
149+
}
150+
skip-extraction: ${{ steps.yarn-cache.outputs.cache-hit }}
151+
95152
- name: Build and push Docker image ${{ inputs.image }}
96153
id: docker_build
97154
uses: docker/build-push-action@v6

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM
233233
else \
234234
export FEATURES_FLAG="--features=console,grovedbg" ; \
235235
export OUT_DIRECTORY=debug ; \
236-
237236
fi && \
238237
if [[ -z "${SCCACHE_MEMCACHED}" ]] ; then unset SCCACHE_MEMCACHED ; fi ; \
239238
cargo build \

0 commit comments

Comments
 (0)