Skip to content

Commit

Permalink
Add override input parameter that controls the rustup override beha…
Browse files Browse the repository at this point in the history
…vior
  • Loading branch information
jonasbb committed Sep 22, 2024
1 parent b31b131 commit 4d1965c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* 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
* Allow installing multiple Rust toolchains by specifying multiple versions in the `toolchain` input parameter.
* Configure the `rustup override` behavior via the new `override` input. (#38)

## [1.9.0] - 2024-06-08

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a
| `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | |
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |
| `override` | Setup the last installed toolchain as the default via `rustup override` | true |

[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache

Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ inputs:
description: "set RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflags"
required: false
default: "-D warnings"
override:
description: "Setup the last installed toolchain as the default via `rustup override`"
required: false
default: "true"

outputs:
rustc-version:
Expand Down Expand Up @@ -132,6 +136,7 @@ runs:
toolchain: ${{inputs.toolchain}}
targets: ${{inputs.target}}
components: ${{inputs.components}}
override: ${{inputs.override}}
shell: bash
run: |
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
Expand All @@ -154,7 +159,10 @@ runs:
fi
rustup toolchain install ${toolchain//,/ } ${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
# Take the last element from the list
rustup override set ${toolchain//*,/ }
if [[ "$override" == "true" ]]
then
rustup override set ${toolchain//*,/ }
fi
fi
- id: versions
Expand Down

0 comments on commit 4d1965c

Please sign in to comment.