Skip to content

Commit 89d3d96

Browse files
authored
Merge pull request #69 from Kubaryt/main
2 parents 1812c7d + 4222ef9 commit 89d3d96

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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-src-dir` | Path from root directory to directory with the Rust source directory (if its not in the root of the repository) | |
6970

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

action.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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-src-dir:
73+
description: "Specify path from root directory to the Rust source directory. By default root directory will be used."
74+
required: false
7275

7376
outputs:
7477
rustc-version:
@@ -163,9 +166,13 @@ runs:
163166
targets: ${{inputs.target}}
164167
components: ${{inputs.components}}
165168
override: ${{inputs.override}}
169+
rust_src_dir: ${{inputs.rust-src-dir}}
166170
shell: bash
167171
run: |
168-
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]]
172+
if [[ -d "$rust_src_dir" ]]; then
173+
cd "$rust_src_dir"
174+
fi
175+
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml") ]]
169176
then
170177
# Install the toolchain as specified in the file
171178
# rustup show is the old way that implicitly installed a toolchain
@@ -222,7 +229,7 @@ runs:
222229
if: inputs.cache == 'true'
223230
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
224231
with:
225-
workspaces: ${{inputs.cache-workspaces}}
232+
workspaces: ${{ inputs.cache-workspaces || inputs.rust-src-dir }}
226233
cache-directories: ${{inputs.cache-directories}}
227234
cache-on-failure: ${{inputs.cache-on-failure}}
228235
cache-bin: ${{inputs.cache-bin}}

0 commit comments

Comments
 (0)