Skip to content

CI: optimize build speeds and cache sizes by migrating to Swatinem/rust-cache #5160

@RishavTiwari25

Description

@RishavTiwari25

I think we should heavily optimize our CI speeds and GitHub Actions storage usage by migrating our manual actions/cache setups exclusively to the industry-standard Swatinem/rust-cache action.

Currently, across our massive .github/workflows/rust.yml workflow, we manually configure actions/cache nearly 15 different times. While this works dynamically, the barebones actions/cache simply zips the massive target/ directory unconditionally. Over time, obsolete compilation garbage accumulates deeply in there, fiercely bloating our GitHub Cache storage quotas towards the 10GB limit before evictions occur.

We should replace all occurrences of actions/cache configured for Cargo with Swatinem/rust-cache@v2. This action is specifically built to maintain Cargo build systems. Not only does it automatically derive robust, granular cache keys, but more importantly, it natively executes cargo-sweep to strip out unused, obsolete compiled artifacts from the target/ directory before zipping and caching it to GitHub.

This guarantees our cache footprint remains incredibly tiny, lightning fast, and strategically ensures we proactively stay clear of GitHub's storage limit!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions