diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-10-15 14:40:17 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-10-15 14:40:17 +0200 |
| commit | 8cd7836dab7a6eddb293eb79591c0d27c3c161a3 (patch) | |
| tree | 182c2f9acfa0dceb9f88262c0c7d16ce5f490aa2 /ci | |
| parent | ceeb7b97b00b57929c21cce7a161382d51c66651 (diff) | |
| parent | 2d4d6dce788be5db233209e1adecd552a633aac2 (diff) | |
| download | mullvadvpn-8cd7836dab7a6eddb293eb79591c0d27c3c161a3.tar.xz mullvadvpn-8cd7836dab7a6eddb293eb79591c0d27c3c161a3.zip | |
Merge branch 'minimal-rust-on-ci'
Diffstat (limited to 'ci')
| -rwxr-xr-x | ci/ci-rust-script.sh | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/ci/ci-rust-script.sh b/ci/ci-rust-script.sh index 797a9e1008..e4f03cc29d 100755 --- a/ci/ci-rust-script.sh +++ b/ci/ci-rust-script.sh @@ -7,8 +7,17 @@ RUSTFLAGS="--deny unused_imports --deny dead_code" source env.sh "" -rustup update $RUST_TOOLCHAIN_CHANNEL -rustup default $RUST_TOOLCHAIN_CHANNEL +RUST_EXTRA_COMPONENTS="" +if [ "${RUST_TOOLCHAIN_CHANNEL}" = "nightly" ]; then + RUST_EXTRA_COMPONENTS+=" -c rustfmt-preview" +fi + +# Install Rust if on Linux or macOS +if [[ "$(uname -s)" == "Linux" || "$(uname -s)" == "Darwin" ]]; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ + -y --default-toolchain $RUST_TOOLCHAIN_CHANNEL --profile minimal $RUST_EXTRA_COMPONENTS + source $HOME/.cargo/env +fi case "$(uname -s)" in MINGW*|MSYS_NT*) @@ -23,13 +32,9 @@ if [ "${RUST_TOOLCHAIN_CHANNEL}" != "nightly" ]; then cargo test --locked --verbose fi -if [ "${RUST_TOOLCHAIN_CHANNEL}" = "nightly" ]; then - if rustup component add rustfmt-preview; then - rustfmt --version; - cargo fmt -- --check --unstable-features; - else - echo "There seems to not be any rustfmt for the current nighly. Skipping formatting check!" - fi +if [[ "${RUST_TOOLCHAIN_CHANNEL}" == "nightly" && "$(uname -s)" == "Linux" ]]; then + rustfmt --version; + cargo fmt -- --check --unstable-features; fi if ! git diff-index --quiet HEAD; then |
