Make toolchain install more robust

This commit is contained in:
Jonas Bushart 2024-09-20 00:39:06 +02:00
parent eb4a655afd
commit 86a2ce6673
2 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add new parameter `cache-directories` that is propagated to `Swatinem/rust-cache` (#44 by @pranc1ngpegasus) * Add new parameter `cache-directories` that is propagated to `Swatinem/rust-cache` (#44 by @pranc1ngpegasus)
* Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) * Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane)
* Make rustup toolchain installation more robust in light of planned changes https://github.com/rust-lang/rustup/issues/3635 and https://github.com/rust-lang/rustup/pull/3985
## [1.9.0] - 2024-06-08 ## [1.9.0] - 2024-06-08

View File

@ -137,8 +137,10 @@ runs:
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]] if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
then then
# Install the toolchain as specified in the file # Install the toolchain as specified in the file
# Might break at some point: https://github.com/rust-lang/rustup/issues/1397 # rustup show is the old way that implicitly installed a toolchain
rustup show # rustup toolchain install is the new explicit way
# https://github.com/rust-lang/rustup/issues/3635#issuecomment-2343511297
rustup show active-toolchain || rustup toolchain install
if [[ -n $components ]]; then if [[ -n $components ]]; then
rustup component add ${components//,/ } rustup component add ${components//,/ }
fi fi