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

Store opam path in a env variable? #898

Open
davesnx opened this issue Nov 21, 2024 · 5 comments
Open

Store opam path in a env variable? #898

davesnx opened this issue Nov 21, 2024 · 5 comments
Labels
wontfix This will not be worked on

Comments

@davesnx
Copy link

davesnx commented Nov 21, 2024

I want to cache the entire opam switch and also the opam binary, which the only form I found is to run a script to capture it:

- name: Get OPAM executable path
  if: steps.opam-cache.outputs.cache-hit != 'true'
  uses: actions/github-script@v7
  with:
    script: |
      const opamPath = await io.which('opam', true);
      console.log('opam executable found: %s', opamPath);

      const fs = require('fs/promises');
      await fs.writeFile('.opam-path', opamPath, 'utf-8');
      console.log('stored path to .opam-path');

Took it from @cknitt's work on rescript. Probably he's interested as well

Would be possible to store this into a github variable?

@cknitt
Copy link

cknitt commented Nov 21, 2024

Took it from @cknitt's work on rescript. Probably he's interested as well

Actually @cometkim's work. 🙂

But definitely interested, too.

@cometkim
Copy link

cometkim commented Nov 21, 2024

Had already asked it before #818

@smorimoto
Copy link
Member

I really don't recommend caching the entire switch.

@smorimoto smorimoto added the wontfix This will not be worked on label Nov 22, 2024
@davesnx
Copy link
Author

davesnx commented Nov 22, 2024

Yes, I read it on the other issue.

This comment #818 (comment) caught me by surprise. Since I have a different experience with caching "the entire world," for example, in ahrefs, we share the switch and also the build folder on each run and haven't faced "out of sync" issues, but it's a more closed environment where opam repo is also embedded.

Anyway, I would like to know what "real world knowledge" I might lack in order to do it myself and also what the complexity is around hen to save and restore the cache, the cache keys, and many other things are based on really complex criteria that are almost impossible to do by the user..

@cometkim
Copy link

I really don't recommend caching the entire switch.

Cache is problematic, I can understand the consideration.

But if I really face a big problem, I can own the risk of customization.

ReScript used to wait 18 minutes for every commit of PR, but after introducing cache, we only wait 6 minutes. We have been using it for 5 months already. Saved A LOT of time.

One thing we experience that the risk we actually take is very small. We have very small dependencies and we rarely update them. The cache got currupted once recently, but we were able to recover it immediately by just clearing the cache entry in the GitHub UI.

Even if it breaks right now and we have to spend a few days maintaining it again, it is already well worth it in terms of the time saving in iterations everyday.

So, I'd say that it was actually worth it to us at least. But I'm not talking about upstreaming it, and I'm not trying to hand off the responsibility of its side effects

I'm just asking expose a little context value so user who willing to build composite actions can find escape hatch. I don't believe it's that difficult to maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants