Swatinem / rust-cache

A GitHub Action that implements smart caching for rust/cargo projects
GNU Lesser General Public License v3.0
1.31k stars 107 forks source link

Option to skip cleaning of some specified src crates in registry/src #100

Closed lrubasze closed 1 year ago

lrubasze commented 1 year ago

In theory cache should be enough to recreate sources and reduce the build time.

However, there are some crates, eg. librocksdb-sys that do not benefit from that. Restoring sources from cache is not enough. (more details ci: enable 'librocksdb-sys' to be able to be properly cached)

How about addressing this problem by checking if some path from cache-directories belongs to registry/src and prevent this path from removal. Or maybe some additional config param with list of src entries to keep?

Oppen commented 1 year ago

Caching all of target can sometimes lead to errors as well, for example when you run test coverage with the likes of llvm-cov. Granted, you could clean the output before the post steps run, but it would be cool to make it easier to express this has cache significance other than with comments.

lrubasze commented 1 year ago

@Oppen thanks for reply. Correct me if I am wrong but I suppose the issue you described refers to caching of target in general, not necessarily in relation to the issue I have described. Unless I am not entirely getting your point.

Oppen commented 1 year ago

Oh, you're right. I misinterpreted the current issue as being related to which subfolders were cached.

Swatinem commented 1 year ago

Maybe just a half-solution, but I excluded -sys crates from the .cargo/registry/src cleanup in https://github.com/Swatinem/rust-cache/commit/f6987ea139b70babe623061b3b9c01a93ea71187