mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-24 04:29:16 +01:00
Add opam example
This commit is contained in:
parent
0c45773b62
commit
0b16518fff
1 changed files with 25 additions and 0 deletions
25
examples.md
25
examples.md
|
@ -24,6 +24,7 @@
|
||||||
- [Node - Yarn](#node---yarn)
|
- [Node - Yarn](#node---yarn)
|
||||||
- [Node - Yarn 2](#node---yarn-2)
|
- [Node - Yarn 2](#node---yarn-2)
|
||||||
- [OCaml/Reason - esy](#ocamlreason---esy)
|
- [OCaml/Reason - esy](#ocamlreason---esy)
|
||||||
|
- [OCaml/Reason - opam](#ocamlreason---opam)
|
||||||
- [PHP - Composer](#php---composer)
|
- [PHP - Composer](#php---composer)
|
||||||
- [Python - pip](#python---pip)
|
- [Python - pip](#python---pip)
|
||||||
- [Simple example](#simple-example)
|
- [Simple example](#simple-example)
|
||||||
|
@ -416,6 +417,30 @@ Esy allows you to export built dependencies and import pre-built dependencies.
|
||||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
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
|
## PHP - Composer
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
Loading…
Reference in a new issue