File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ First, all items specified in the toolchain file are installed.
4949Afterward, the `components` and `target` specified via inputs are installed in addition to the items from the toolchain file.
5050
5151| Name | Description | Default |
52- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------- | ------------- |
52+ |--------------------------| ------------------------------------------------------------------------------------------------------------------------- | ------------- |
5353| `toolchain` | Comma-separated list of Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. The last version is the default. | stable |
5454| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
5555| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
@@ -66,6 +66,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a
6666| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
6767| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |
6868| `override` | Setup the last installed toolchain as the default via `rustup override` | true |
69+ | `rust-toolchain-dir` | Path from root directory to directory with the rust toolchain file (if its not in the root of the repository) | |
6970
7071[`Swatinem/rust-cache`] : https://github.com/Swatinem/rust-cache
7172
Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ inputs:
6969 description : " Setup the last installed toolchain as the default via `rustup override`"
7070 required : false
7171 default : " true"
72+ rust-toolchain-dir :
73+ description : " Specify path from root directory to the directory to search for rust-toolchain.toml file. By default root directory will be used."
74+ required : false
7275
7376outputs :
7477 rustc-version :
@@ -163,14 +166,18 @@ runs:
163166 targets : ${{inputs.target}}
164167 components : ${{inputs.components}}
165168 override : ${{inputs.override}}
169+ rust_toolchain_dir : ${{inputs.rust-toolchain-dir}}
166170 shell : bash
167171 run : |
168- if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
172+ if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" || -f "$rust_toolchain_dir/rust-toolchain.toml" ) ]]
169173 then
170174 # Install the toolchain as specified in the file
171175 # rustup show is the old way that implicitly installed a toolchain
172176 # rustup toolchain install is the new explicit way
173177 # https://github.com/rust-lang/rustup/issues/3635#issuecomment-2343511297
178+ if [[ -n "$rust_toolchain_dir" ]]; then
179+ cd "$rust_toolchain_dir"
180+ fi
174181 rustup show active-toolchain || rustup toolchain install
175182 if [[ -n $components ]]; then
176183 rustup component add ${components//,/ }
You can’t perform that action at this time.
0 commit comments