From 7a2d2283606dcbc1eeea8f51eada66b597315d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n=20Sz=C5=B1cs?= Date: Sun, 9 Sep 2018 12:32:46 +0200 Subject: [PATCH] ARROW-2520: [Rust] CI should also build against nightly Rust MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: Krisztián Szűcs Closes #2477 from kszucs/ARROW-2520 and squashes the following commits: 79b1e7a8 check against "Rust" in appceyor-install.bat 4a31a422 fix install script 99b99b65 set rust stable toolchain as default after running tests on appveyor f941121f use rustup environment variable 15b6358a don't parenthesize 07db3d94 make travis_install_cargo executable 8af4c761 test both stable and nightly rust in the same CI step 2720e1ed remove rust from allow_failures c5dd1449 separate matrix step 79839767 remove beta channel 40c0ed82 rust against rust nightly --- .travis.yml | 11 ++++------- appveyor.yml | 3 +-- ci/appveyor-build.bat | 18 ++++++++++++++++-- ci/appveyor-install.bat | 6 ++++-- ci/travis_install_cargo.sh | 32 ++++++++++++++++++++++++++++++++ ci/travis_script_rust.sh | 4 ++++ 6 files changed, 61 insertions(+), 13 deletions(-) create mode 100755 ci/travis_install_cargo.sh diff --git a/.travis.yml b/.travis.yml index d919baff6d386..43a5725cdf3c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,7 +212,6 @@ matrix: # Rust - language: rust cache: cargo - rust: stable addons: apt: packages: @@ -223,17 +222,15 @@ matrix: - cmake before_script: - if [ $ARROW_CI_RUST_AFFECTED != "1" ]; then exit; fi - - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH - - export CARGO_TARGET_DIR=$TRAVIS_BUILD_DIR/target - - cargo install cargo-travis || echo "Skipping cargo-travis installation as it already exists in cache" - - export PATH=$HOME/.cargo/bin:$PATH + - $TRAVIS_BUILD_DIR/ci/travis_install_cargo.sh script: - - $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh + - RUSTUP_TOOLCHAIN=stable $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh + - RUSTUP_TOOLCHAIN=nightly $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh || true after_success: - pushd ${TRAVIS_BUILD_DIR}/rust # Run coverage for codecov.io - mkdir -p target/kcov - - RUST_BACKTRACE=1 cargo coverage --verbose + - RUST_BACKTRACE=1 RUSTUP_TOOLCHAIN=stable cargo coverage --verbose - bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" # Go - language: go diff --git a/appveyor.yml b/appveyor.yml index 1bbdf65bd2ede..18ad9f5f56c5d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -60,8 +60,7 @@ environment: GENERATOR: Ninja CONFIGURATION: "Release" BUILD_SCRIPT: "CMake_Build_Script" - - JOB: "Rust_Stable" - RUST_VERSION: stable + - JOB: "Rust" TARGET: x86_64-pc-windows-msvc USE_CLCACHE: false diff --git a/ci/appveyor-build.bat b/ci/appveyor-build.bat index 4d6f04791ccad..304afc0887b6a 100644 --- a/ci/appveyor-build.bat +++ b/ci/appveyor-build.bat @@ -17,12 +17,26 @@ @echo on -if "%JOB%" == "Rust_Stable" ( - cd rust +if "%JOB%" == "Rust" ( + pushd rust + + rustup default stable + rustup show cargo build --target %TARGET% || exit /B cargo build --target %TARGET% --release || exit /B cargo test --target %TARGET% || exit /B cargo test --target %TARGET% --release || exit /B + + rustup default nightly + rustup show + cargo build --target %TARGET% + cargo build --target %TARGET% --release + cargo test --target %TARGET% + cargo test --target %TARGET% --release + + rustup default stable + + popd ) else ( git config core.symlinks true git reset --hard diff --git a/ci/appveyor-install.bat b/ci/appveyor-install.bat index f514e78ec1339..483f262368656 100644 --- a/ci/appveyor-install.bat +++ b/ci/appveyor-install.bat @@ -17,10 +17,12 @@ @echo on -if "%JOB%" == "Rust_Stable" ( +if "%JOB%" == "Rust" ( 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 stable set "PATH=%PATH%;C:\Users\Appveyor\.cargo\bin" + rustup install stable + rustup install nightly rustc -Vv cargo -V ) else ( diff --git a/ci/travis_install_cargo.sh b/ci/travis_install_cargo.sh new file mode 100755 index 0000000000000..f433033091ce1 --- /dev/null +++ b/ci/travis_install_cargo.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e + +# ensure that both toolchains are installed +rustup install stable +rustup install nightly + +pip install 'travis-cargo<0.2' --user + +export PATH=$HOME/.local/bin:$PATH +export CARGO_TARGET_DIR=$TRAVIS_BUILD_DIR/target + +cargo install cargo-travis || echo "Skipping cargo-travis installation as it already exists in cache" +export PATH=$HOME/.cargo/bin:$PATH diff --git a/ci/travis_script_rust.sh b/ci/travis_script_rust.sh index f85820fdbc0a6..9fecb3f214b5e 100755 --- a/ci/travis_script_rust.sh +++ b/ci/travis_script_rust.sh @@ -23,9 +23,13 @@ RUST_DIR=${TRAVIS_BUILD_DIR}/rust pushd $RUST_DIR +# show activated toolchain +rustup show + # raises on any formatting errors rustup component add rustfmt-preview cargo fmt --all -- --check + # raises on any warnings cargo rustc -- -D warnings