Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: Add opam example #1439

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rusty-key
Copy link

Successfully set up opam dependency caching, sharing the config in case it is useful to someone else

@rusty-key rusty-key requested a review from a team as a code owner July 23, 2024 15:44
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the separate steps for restore and save needed here?

The default action will add a save post step automatically for you and handle checking the cache-hit output.

    - name: Cache opam
      uses: actions/cache@v4
      with:
        path: _opam
        key: ${{ runner.os }}-opam-${{ hashFiles('opam.locked') }}

    - name: Install dependencies
      run: opam install . --locked --deps-only -y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants