Skip to content

Preserve by default or allow preserving additional subdirectories within target #388

Description

@tgross35

target is sometimes used as a cache location for things not directly generated by Cargo, but rust-cache deletes them. For example, this job https://github.com/rust-lang/rustc_apfloat/actions/runs/35438411679/job/105885391420 downloads LLVM and stashes it in target, but it is removed before creating the cache:

[4](https://github.com/rust-lang/rustc_apfloat/actions/runs/35437756735/job/105883349149#step:13:55)
##[debug]collecting metadata for "/home/runner/work/rustc_apfloat/rustc_apfloat"
##[debug]workspace "/home/runner/work/rustc_apfloat/rustc_apfloat" has 89 packages
... Cleaning /home/runner/work/rustc_apfloat/rustc_apfloat/target ...
##[debug]cleaning target directory "/home/runner/work/rustc_apfloat/rustc_apfloat/target"
##[debug]cleaning profile directory "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/.cargo-artifact-lock"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/examples"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/.cargo-build-lock"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/incremental"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/.cargo-lock"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/build/rustc_apfloat-fuzz"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/debug/build/rustc_apfloat"
##[debug]deleting "/home/runner/work/rustc_apfloat/rustc_apfloat/target/.rustc_info.json"
##[debug]cleaning target directory "/home/runner/work/rustc_apfloat/rustc_apfloat/target/tmp"
##[debug]cleaning target directory "/home/runner/work/rustc_apfloat/rustc_apfloat/target/llvm-downloads"
##[debug]cleaning target directory "/home/runner/work/rustc_apfloat/rustc_apfloat/target/llvm-downloads/llvm-project-a284bdb31146"
...

Would it be possible to not auto-delete files that aren't part of Cargo's layout, or allowing specific files/directories to skip deleting?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions