This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-rust.yml
49 lines (46 loc) · 1.68 KB
/
install-rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# defaults for any parameters that aren't specified
parameters:
rust: stable
components: []
targets: []
steps:
# Linux and macOS.
- script: |
set -e
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
env:
RUSTUP_TOOLCHAIN: ${{parameters.rust}}
displayName: "Install rust (*nix)"
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
# Windows.
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --profile minimal --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
env:
RUSTUP_TOOLCHAIN: ${{parameters.rust}}
displayName: "Install rust (windows)"
condition: eq(variables['Agent.OS'], 'Windows_NT')
# Set correct toolchain
- bash: |
rustup default $RUSTUP_TOOLCHAIN
rustup update $RUSTUP_TOOLCHAIN
env:
RUSTUP_TOOLCHAIN: ${{parameters.rust}}
displayName: "Set correct Rust version"
# Install additional targets:
- ${{ each target in parameters.targets }}:
- script: rustup target add ${{ target }}
displayName: "Adding target '${{ target }}'"
# Install additional components:
- ${{ each component in parameters.components }}:
- script: rustup component add ${{ component }}
displayName: "Adding component '${{ component }}'"
# See what we got
- script: |
rustc --version
cargo --version
rustup --version
displayName: Check installed rust version