selecting a toolchain either by action or manual rustup calls should happen before the plugin, as the cache uses the current rustc version as its cache key
In practice we weren't affected too much, because it turns out the cache key is also derived using all environment variables that have the prefix RUST, which includes e.g. our RUST_STABLE_VER. So even if the key was derived using the CI runner's pre-installed old Rust toolchain, our env variable prevented most conflicts.
The cache docs also state that it does not cache, by cleaning the following:
Any files in ~/.cargo/bin that were present before the action ran (for example rustc).
As we were installing the toolchain after the cache action, the potential for caching the toolchain seems there. However the cache size hasn't changed after this ordering change. Perhaps it does a simple path check only and the pre-installed toolchain was in the same path.
In any case, better to invoke the cache action after the toolchain has been installed, as the docs suggest.
The cache action's docs state:
In practice we weren't affected too much, because it turns out the cache key is also derived using all environment variables that have the prefix
RUST
, which includes e.g. ourRUST_STABLE_VER
. So even if the key was derived using the CI runner's pre-installed old Rust toolchain, our env variable prevented most conflicts.The cache docs also state that it does not cache, by cleaning the following:
As we were installing the toolchain after the cache action, the potential for caching the toolchain seems there. However the cache size hasn't changed after this ordering change. Perhaps it does a simple path check only and the pre-installed toolchain was in the same path.
In any case, better to invoke the cache action after the toolchain has been installed, as the docs suggest.