Skip to content

Commit 557a2c8

Browse files
fix[ci]: skip rustup install if installed (#6885)
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent b2d22eb commit 557a2c8

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

.github/actions/setup-rust/action.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,32 @@ runs:
3838
if: runner.os == 'Linux'
3939
uses: rui314/setup-mold@v1
4040

41+
- name: Check for rustup
42+
id: check-rustup
43+
shell: bash
44+
run: echo "exists=$(command -v rustup &> /dev/null && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
45+
4146
- name: Rust Toolchain
4247
id: rust-toolchain
4348
uses: dtolnay/rust-toolchain@stable
44-
if: steps.rustup-cache.outputs.cache-hit != 'true'
49+
if: steps.check-rustup.outputs.exists != 'true'
4550
with:
4651
toolchain: "${{ steps.toolchain-config.outputs.toolchain }}"
4752
targets: "${{ inputs.targets }}"
4853
components: "${{ inputs.components }}"
4954

55+
- name: Install additional targets and components
56+
if: steps.check-rustup.outputs.exists == 'true'
57+
shell: bash
58+
run: |
59+
rustup toolchain install "$TOOLCHAIN"
60+
[[ -n "$TARGETS" ]] && rustup target add --toolchain "$TOOLCHAIN" ${TARGETS//,/ }
61+
[[ -n "$COMPONENTS" ]] && rustup component add --toolchain "$TOOLCHAIN" ${COMPONENTS//,/ }
62+
env:
63+
TOOLCHAIN: ${{ steps.toolchain-config.outputs.toolchain }}
64+
TARGETS: ${{ inputs.targets }}
65+
COMPONENTS: ${{ inputs.components }}
66+
5067
- name: Configure sccache timeout
5168
if: inputs.enable-sccache == 'true'
5269
shell: bash

0 commit comments

Comments
 (0)