mirror of
https://github.com/actions/cache.git
synced 2024-12-01 14:22:24 +08:00
Compare commits
3 Commits
ee4f732959
...
86281bbc8c
Author | SHA1 | Date | |
---|---|---|---|
|
86281bbc8c | ||
|
8469c94c6a | ||
|
0b16518fff |
@ -157,6 +157,7 @@ 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)
|
||||
|
46
examples.md
46
examples.md
@ -1,5 +1,6 @@
|
||||
# Examples
|
||||
|
||||
- [Bun](#bun)
|
||||
- [C# - NuGet](#c---nuget)
|
||||
- [Clojure - Lein Deps](#clojure---lein-deps)
|
||||
- [D - DUB](#d---dub)
|
||||
@ -24,6 +25,7 @@
|
||||
- [Node - Yarn](#node---yarn)
|
||||
- [Node - Yarn 2](#node---yarn-2)
|
||||
- [OCaml/Reason - esy](#ocamlreason---esy)
|
||||
- [OCaml/Reason - opam](#ocamlreason---opam)
|
||||
- [PHP - Composer](#php---composer)
|
||||
- [Python - pip](#python---pip)
|
||||
- [Simple example](#simple-example)
|
||||
@ -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):
|
||||
@ -416,6 +438,30 @@ Esy allows you to export built dependencies and import pre-built dependencies.
|
||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
||||
```
|
||||
|
||||
## OCaml/Reason - opam
|
||||
|
||||
This example requires you to have `opam.locked` file which you can generate with `opam lock .`.
|
||||
|
||||
It's worth noting that even if lock file was change, it might be optimal to restore previous cache, so `hashFiles` in the key and if statement in "Save opam cache" step are optional.
|
||||
```yaml
|
||||
- name: Restore opam cache
|
||||
id: restore-cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: _opam
|
||||
key: ${{ runner.os }}-opam-${{ hashFiles('opam.locked') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: opam install . --locked --deps-only -y
|
||||
|
||||
- name: Save opam cache
|
||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: _opam
|
||||
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
|
||||
```
|
||||
|
||||
## PHP - Composer
|
||||
|
||||
```yaml
|
||||
|
Loading…
Reference in New Issue
Block a user