Use CI caching and cargo feature install-upgrade

* do not force to install rustfmt
* use cargo-cache
* disable bash trace
* clone single branch
This commit is contained in:
Lzu Tao 2019-10-16 13:14:24 +07:00
parent 07c06738b7
commit d81191e87d
3 changed files with 19 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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