From d81191e87dfa79b08cd107908dee63f77b501cef Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Wed, 16 Oct 2019 13:14:24 +0700 Subject: [PATCH] Use CI caching and cargo feature install-upgrade * do not force to install rustfmt * use cargo-cache * disable bash trace * clone single branch --- .travis.yml | 13 +++++++++++-- appveyor.yml | 8 +++++++- setup-toolchain.sh | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6439fe82bba7..6c957d367ead 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,13 @@ branches: - trying.tmp - staging.tmp +cache: + directories: + - $HOME/.cargo +before_cache: + - cargo install -Z install-upgrade cargo-cache --debug + - cargo cache --autoclean + env: global: - RUST_BACKTRACE=1 @@ -23,8 +30,10 @@ before_install: - export PATH="$HOME/.cargo/bin:$PATH" install: - | - if [ -z ${INTEGRATION} ]; then - rustup component add rustfmt || cargo install --git https://github.com/rust-lang/rustfmt/ --force + if [[ -z ${INTEGRATION} ]]; then + if ! rustup component add rustfmt; then + cargo install -Z install-upgrade --git https://github.com/rust-lang/rustfmt --bin rustfmt + fi if [ "$TRAVIS_OS_NAME" == "linux" ]; then . $HOME/.nvm/nvm.sh nvm install stable diff --git a/appveyor.yml b/appveyor.yml index b28ff5273e44..d15bdec98f0f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,12 +13,18 @@ branches: - auto - try +cache: + - '%USERPROFILE%\.cargo' +on_finish: + - cargo install -Z install-upgrade cargo-cache --debug + - cargo cache --autoclean + install: - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly --profile=minimal - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - del rust-toolchain - - cargo install rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed" + - cargo install -Z install-upgrade rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed" - rustup-toolchain-install-master -f -n master - rustup component add rustfmt --toolchain nightly & exit 0 # Format test handles missing rustfmt - rustup default master diff --git a/setup-toolchain.sh b/setup-toolchain.sh index b83116606894..27c2e87f1722 100755 --- a/setup-toolchain.sh +++ b/setup-toolchain.sh @@ -7,6 +7,7 @@ cd "$(dirname "$0")" || exit if ! command -v rustup-toolchain-install-master > /dev/null; then cargo install \ + -Z install-upgrade \ rustup-toolchain-install-master \ --bin rustup-toolchain-install-master \ --debug