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

Enable cache sweeping in CI #289

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Conversation

BD103
Copy link
Member

@BD103 BD103 commented Aug 28, 2024

Addresses part of #212.

I recently merged a feature into Leafwing-Studios/cargo-cache v2.3.0 that automatically deletes unused build artifacts before creating a new cache, to prevent cache sizes from snowballing.

It's disabled by default due to backward compatibility reasons, so this PR enables it. Cache sweeping should keep cache sizes small and workflow runs fast.

(As an side, should a cache be used at all in the release build? Caching prevents builds from being reproducible, and can introduce the occasional issue when building.)

This will be reverted in the future. It is done for demonstration purposes only.
Copy link
Collaborator

@benfrankel benfrankel left a comment

Choose a reason for hiding this comment

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

Caching in release is nice for faster iteration during a game jam (e.g. with playtesters). The caveat is you have to keep releasing to the same version tag, because GitHub is silly -- but it works. There could be a flag in the env variables to disable it, but it should be supported and probably enabled by default.

Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@janhohenheim janhohenheim left a comment

Choose a reason for hiding this comment

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

Agreed with @benfrankel. I think the pros outweigh the cons for most people, and if you care about these things enough, you can disable the cache very simply.

@BD103
Copy link
Member Author

BD103 commented Aug 28, 2024

I made a temporary commit (7188e2c) that updates some dependencies, which will make some build artifacts stale. After looking at the run, it removed 365 MiB on the Clippy and Docs jobs and removed a whopping 3.68 GiB on the Tests job.

These savings will only occur when a fallback key is used (typically when Cargo.lock or Cargo.toml is changed), but are quite significant. The only downside is an ~2 second overhead in the cache action from downloading cargo-sweep.

@janhohenheim
Copy link
Member

That's really impressive :D Good work!

@benfrankel benfrankel merged commit fe7a01f into TheBevyFlock:main Aug 28, 2024
4 checks passed
@BD103 BD103 deleted the sweep-cache branch August 29, 2024 01:05
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.

3 participants