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