Skip to content

Commit

Permalink
ci: store cargo and yarn cache mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Nov 8, 2024
1 parent a333049 commit 39e9d43
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/actions/docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,63 @@ runs:
# name: ${{ inputs.image_name }}
# bucket: ${{ inputs.bucket }}

RUN --mount=type=cache,sharing=shared,id=,target=${CARGO_HOME}/registry/index \
--mount=type=cache,sharing=shared,id=cargo_registry_cache,target=${CARGO_HOME}/registry/cache \
--mount=type=cache,sharing=shared,id=cargo_git,target=${CARGO_HOME}/git/db \

- name: Cargo cache for Docker
uses: actions/cache@v4
id: cargo-cache
with:
path: |
../cargo-cache-registry-index
../cargo-cache-registry-cache
../cargo-cache-git-db
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys:
- ${{ runner.os }}-cargo-

- name: Inject cargo cache into docker
uses: reproducible-containers/buildkit-cache-dance@3
with:
cache-map: |
{
"../cargo-cache-registry-index": {
"target": "/root/.cargo/registry/index",
"id": "cargo_registry_index"
},
"../cargo-cache-registry-cache": {
"target": "/root/.cargo/registry/cache",
"id": "cargo_registry_index"
},
"../cargo-cache-git-db": {
"target": "/root/.cargo/git/db",
"id": "cargo_registry_index"
},
}
skip-extraction: ${{ steps.cargo-cache.outputs.cache-hit }}

- name: Yarn unplugged cache for Docker
uses: actions/cache@v4
id: yarn-cache
with:
path: ../yarn-unplugged-cache
key: ${{ runner.os }}-yarn-unplugged-amd64-${{ hashFiles('yarn.lock') }}
restore-keys:
- ${{ runner.os }}-yarn-unplugged-amd64-

- name: Inject cargo cache into docker
uses: reproducible-containers/buildkit-cache-dance@3
with:
cache-map: |
{
"../yarn-unplugged-cache": {
"target": "/tmp/unplugged",
"id": "unplugged_amd64"
},
}
skip-extraction: ${{ steps.yarn-cache.outputs.cache-hit }}

- name: Build and push Docker image ${{ inputs.image }}
id: docker_build
uses: docker/build-push-action@v6
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ RUN --mount=type=cache,sharing=shared,id=cargo_registry_index,target=${CARGO_HOM
else \
export FEATURES_FLAG="--features=console,grovedbg" ; \
export OUT_DIRECTORY=debug ; \
fi && \
if [[ -z "${SCCACHE_MEMCACHED}" ]] ; then unset SCCACHE_MEMCACHED ; fi ; \
cargo build \
Expand Down

0 comments on commit 39e9d43

Please sign in to comment.