holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
694 stars 31 forks source link

Prune build artifacts for CI caching speed up #23

Open Eh2406 opened 5 years ago

Eh2406 commented 5 years ago

Some high profile projects have seen speed ups on CI by removing the final artifacts before caching. Specifically crates.io. However when crater tried a generalized version of this it broke a lot of things.

Plan of attack:

  1. use cargo_metadata::Target to get the list of all names to remove.
  2. look at cargos code to see how the name is normalized into the file structure. (crates.io is just replacing - with _, but we should make sure that is correct in general.)
  3. add a sub command that removes the appropriate files.
  4. test that it works on crates.io code.
  5. test that it works on several of the crates that broke on crater.

I meant to look at this this past weekend but did not have time. This is mostly notes for when I next have time.

jyn514 commented 1 year ago

Some high profile projects have seen speed ups on CI by removing the final artifacts before caching. Specifically crates.io. However when crater tried a generalized version of this it broke a lot of things.

My reading of that issue is that it was a bug in the crater implementation, and not the idea itself: https://github.com/rust-lang/crater/pull/387#issuecomment-452908458. Anyway, I think crater is mostly unrelated and we should be able to implement this in cargo-sweep.

(crates.io is just replacing - with _, but we should make sure that is correct in general.)

I don't think that's true? If you look at the target dir for cargo-sweep itself, it has the original dash:

; file target/debug/cargo-sweep
target/debug/cargo-sweep: Mach-O 64-bit executable arm64

Is there something you were referring to other than the final executable?

cc https://github.com/holmgr/cargo-sweep/issues/77