aboutsummaryrefslogtreecommitdiff
path: root/ci/install-rust.sh
blob: 3e0b27ae84e577af0077b98da166729cef8752b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

set -euo pipefail

toolchain="${1:-nightly}"

if rustup -V 2>/dev/null; then
    rustup set profile minimal
    rustup update "${toolchain}" --no-self-update
    rustup default "${toolchain}"
else
    curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "${toolchain}"
    export PATH=${PATH}:${HOME}/.cargo/bin
    echo "##[add-path]${HOME}/.cargo/bin"
fi

echo "Query rust and cargo versions:"
rustup -V
rustc -V
cargo -V