mirror of
https://github.com/actions-rust-lang/setup-rust-toolchain.git
synced 2025-12-27 01:54:20 -05:00
enhancement: Add option to specify rust-toolchain.toml path (#47)
This commit is contained in:
@@ -66,6 +66,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a
|
|||||||
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
|
| `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" |
|
| `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 |
|
| `override` | Setup the last installed toolchain as the default via `rustup override` | true |
|
||||||
|
| `rust-toolchain-dir` | Path from root directory to directory with the rust toolchain file (if its not in the root of the repository) | |
|
||||||
|
|
||||||
[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache
|
[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ inputs:
|
|||||||
description: "Setup the last installed toolchain as the default via `rustup override`"
|
description: "Setup the last installed toolchain as the default via `rustup override`"
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
|
rust-toolchain-dir:
|
||||||
|
description: "Specify path from root directory to the directory to search for rust-toolchain.toml file. By default root directory will be used."
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
rustc-version:
|
rustc-version:
|
||||||
@@ -163,14 +166,18 @@ runs:
|
|||||||
targets: ${{inputs.target}}
|
targets: ${{inputs.target}}
|
||||||
components: ${{inputs.components}}
|
components: ${{inputs.components}}
|
||||||
override: ${{inputs.override}}
|
override: ${{inputs.override}}
|
||||||
|
rust_toolchain_dir: ${{inputs.rust-toolchain-dir}}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
|
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" || -f "$rust_toolchain_dir/rust-toolchain.toml") ]]
|
||||||
then
|
then
|
||||||
# Install the toolchain as specified in the file
|
# Install the toolchain as specified in the file
|
||||||
# rustup show is the old way that implicitly installed a toolchain
|
# rustup show is the old way that implicitly installed a toolchain
|
||||||
# rustup toolchain install is the new explicit way
|
# rustup toolchain install is the new explicit way
|
||||||
# https://github.com/rust-lang/rustup/issues/3635#issuecomment-2343511297
|
# https://github.com/rust-lang/rustup/issues/3635#issuecomment-2343511297
|
||||||
|
if [[ -n "$rust_toolchain_dir" ]]; then
|
||||||
|
cd "$rust_toolchain_dir"
|
||||||
|
fi
|
||||||
rustup show active-toolchain || rustup toolchain install
|
rustup show active-toolchain || rustup toolchain install
|
||||||
if [[ -n $components ]]; then
|
if [[ -n $components ]]; then
|
||||||
rustup component add ${components//,/ }
|
rustup component add ${components//,/ }
|
||||||
|
|||||||
Reference in New Issue
Block a user