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 | |
| parent | ceeb7b97b00b57929c21cce7a161382d51c66651 (diff) | |
| parent | 2d4d6dce788be5db233209e1adecd552a633aac2 (diff) | |
| download | mullvadvpn-8cd7836dab7a6eddb293eb79591c0d27c3c161a3.tar.xz mullvadvpn-8cd7836dab7a6eddb293eb79591c0d27c3c161a3.zip | |
Merge branch 'minimal-rust-on-ci'
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | Dockerfile | 2 | ||||
| -rw-r--r-- | appveyor.yml | 2 | ||||
| -rwxr-xr-x | ci/ci-rust-script.sh | 23 |
4 files changed, 16 insertions, 13 deletions
diff --git a/.travis.yml b/.travis.yml index 27cab903cc..cafe1b5480 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ matrix: - android-28 - build-tools-28.0.3 install: - - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y + - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable --profile minimal -y - source $HOME/.cargo/env - rustup target add aarch64-linux-android - curl -sf -L -o /tmp/ndk.zip https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip diff --git a/Dockerfile b/Dockerfile index 215fa06231..d4e9a14022 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,5 @@ RUN apt install build-essential \ curl \ p7zip-full \ git -y -RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain none -ENV PATH="/root/.cargo/bin/:${PATH}" RUN mkdir /mvd CMD tail -f /dev/null diff --git a/appveyor.yml b/appveyor.yml index 8f0698ec15..e1af1d1e20 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,7 +36,7 @@ install: } - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% + - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% --profile minimal - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin # TMP fix for https://github.com/rust-lang-nursery/rustup.rs/issues/893: - set PATH=%PATH%;C:\Users\appveyor\.rustup\toolchains\%RUST_VERSION%-%TARGET%\bin 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 |
