mirror of
https://github.com/actions/cache.git
synced 2024-12-01 06:12:25 +08:00
Compare commits
3 Commits
8795908afa
...
d1d9141909
Author | SHA1 | Date | |
---|---|---|---|
|
d1d9141909 | ||
|
8469c94c6a | ||
|
b045ea1d9e |
@ -157,10 +157,12 @@ Every programming language and framework has its own way of caching.
|
||||
|
||||
See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
|
||||
|
||||
* [Bun](./examples.md#bun)
|
||||
* [C# - NuGet](./examples.md#c---nuget)
|
||||
* [Clojure - Lein Deps](./examples.md#clojure---lein-deps)
|
||||
* [D - DUB](./examples.md#d---dub)
|
||||
* [Deno](./examples.md#deno)
|
||||
* [Docker](./examples.md#docker)
|
||||
* [Elixir - Mix](./examples.md#elixir---mix)
|
||||
* [Go - Modules](./examples.md#go---modules)
|
||||
* [Haskell - Cabal](./examples.md#haskell---cabal)
|
||||
|
56
examples.md
56
examples.md
@ -1,5 +1,6 @@
|
||||
# Examples
|
||||
|
||||
- [Bun](#bun)
|
||||
- [C# - NuGet](#c---nuget)
|
||||
- [Clojure - Lein Deps](#clojure---lein-deps)
|
||||
- [D - DUB](#d---dub)
|
||||
@ -9,6 +10,7 @@
|
||||
- [Linux](#linux)
|
||||
- [macOS](#macos)
|
||||
- [Windows](#windows-1)
|
||||
- [Docker](#docker)
|
||||
- [Elixir - Mix](#elixir---mix)
|
||||
- [Erlang - Rebar3](#erlang--rebar3)
|
||||
- [Go - Modules](#go---modules)
|
||||
@ -41,6 +43,26 @@
|
||||
- [Swift - Mint](#swift---mint)
|
||||
- [* - Bazel](#---bazel)
|
||||
|
||||
## Bun
|
||||
|
||||
```yaml
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.bun/install/cache
|
||||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
```yaml
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~\.bun
|
||||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||
```
|
||||
|
||||
## C# - NuGet
|
||||
|
||||
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
||||
@ -155,6 +177,40 @@ steps:
|
||||
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
```yaml
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: my-project-${{ matrix.arch }}-buildx-${{ hashFiles('my-directory/Dockerfile') }}
|
||||
restore-keys: |
|
||||
my-project-${{ matrix.arch }}-buildx-
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build and Test
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: false
|
||||
context: .
|
||||
platforms: ${{ matrix.arch }}
|
||||
file: my-directory/Dockerfile
|
||||
tags: my-username/my-image:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||
-
|
||||
# Temporary workaround
|
||||
# https://github.com/docker/build-push-action/issues/252
|
||||
# https://github.com/moby/buildkit/issues/1896
|
||||
name: Move cache
|
||||
run: |
|
||||
rm -rf /tmp/.buildx-cache
|
||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||
```
|
||||
|
||||
## Elixir - Mix
|
||||
|
||||
```yaml
|
||||
|
Loading…
Reference in New Issue
Block a user