In GitLab's CI, I can breakdown my build into stages and each stage can pass artifacts to the next configuration:
cache:
paths:
- target/
- Cargo.lock
However, if the cache directory is outside the project directory or the /cache
directory, it becomes hard to pass those artifacts along. I need to tell Cargo a good place to put (and look for) its cached crates.
In my case, I wish to use /cache/cargo/registry/...
rather than ~/.cargo/registry/...
. or /usr/local/cargo/registry/...
.
Bonus points for doing that via an environment variable.