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

feat: skip small files (<5KB) #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hraban
Copy link

@hraban hraban commented May 22, 2024

Totally arbitrary limit. Never programmed Rust so I have no idea if this work. Can't build it locally even using the nix from the flake.

Fixes DeterminateSystems/magic-nix-cache-action#31 ?

@grahamc
Copy link
Member

grahamc commented May 22, 2024

Thanks for the PR! I'll tag in @edolstra to see if this makes sense with the invariants of caches. One thing to note is this is really a proxy for how long the build takes, which is a bit more important.

@hraban hraban marked this pull request as ready for review May 22, 2024 13:12
@hraban
Copy link
Author

hraban commented May 22, 2024

I'd be happy to test this locally in my project but I'm not sure how. I tried to use source-pr but it can't find the binary--I'm assuming it didn't get built because I'm unknown on this project? See https://github.com/hraban/cl-nix-lite/actions/runs/9185180443/job/25258704165

@hraban hraban force-pushed the feat/skip-small branch from ae53105 to 13a8c20 Compare May 22, 2024 19:50
@hraban
Copy link
Author

hraban commented May 22, 2024

I was able to build this on aarch64-darwin and x86_64-darwin using nix run https://flakehub.com/f/NixOS/nix/2.20.tar.gz -- build.

One thing to note is this is really a proxy for how long the build takes, which is a bit more important.

I've added this as a comment.

@lucperkins
Copy link
Member

lucperkins commented May 22, 2024

@hraban I've added the upload to s3 label which will enable you to use source-pr (though you will need to push another change here and wait until the upload is complete, which takes a few minutes).

EDIT: actually no, that label only works that way for PRs opened in our org, so source-pr will not be available here.

@DaRacci
Copy link

DaRacci commented Dec 9, 2024

This seems like a solid solution, it would eliminate more than half the cache entries i get for my project and allow more use of actually useful cached items.

Maybe one thing is you could have the size limit able to be customised through an env variable during launch, eg (NAR_SIZE_LIMIT=2000) if a user finds that their project has a weird outlier that takes a while to create but the result is still small.

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.

Is it possible to avoid caching tiny outputs?
5 participants