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

Cache shell evaluation result #23

Open
YorikSar opened this issue Dec 20, 2024 · 0 comments
Open

Cache shell evaluation result #23

YorikSar opened this issue Dec 20, 2024 · 0 comments

Comments

@YorikSar
Copy link
Member

Is your feature request related to a problem? Please describe.
If the script running in the shell is quite fast, shell evaluation can take the most of the runtime, especially if one job has multiple scripts running with the same shell. I have a project with a shell that takes ~10s to evaluate and 4 steps running in the shell. It means that even if the actions themselves only check if build results are in cache and take less than a second, job runtime is at least 40s because of the shell evaluation.

Describe the solution you'd like
I think we could have an option to cache evaluation result from the shell, possibly keyed to the hash of the shell.nix/default.nix. It could be off by default. It could also be set by the user to the hash generated by {{ hashFiles('default.nix') }} so that we don't have to guess what to hash.

Describe alternatives you've considered
I could do something along the lines of:

- name: eval-shell 
  run: |
    echo "drv=$(nix-instantiate shell.nix)" >> "$GITHUB_OUTPUT"
- uses: tweag/run-nix-shell@v0
  with:
    derivation-path: ${{ steps.eval-shell.outputs.drv }}
    run: |
      true

But it would be nice to have it integrated (and possibly invisible) in the action itself.

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

No branches or pull requests

1 participant