ci: remove unused .crate files before caching

This commit is contained in:
Trevor Spiteri 2019-12-31 17:30:28 +01:00
parent c6e9ecbfb1
commit 513a27c343
2 changed files with 6 additions and 4 deletions

View File

@ -18,7 +18,7 @@ cache:
- '%USERPROFILE%\.cargo\registry\cache -> Cargo.toml'
install:
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
- set PATH=C:\msys64\usr\bin;%USERPROFILE%\.cargo\bin;%PATH%
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- rustup-init.exe -y --default-host %TARGET% --default-toolchain none --no-modify-path
- rustup --version
@ -28,7 +28,8 @@ install:
build: false
before_test:
- C:\msys64\usr\bin\bash -c "if [ -d ""$USERPROFILE/.cargo/registry/cache"" ]; then cd ""$USERPROFILE/.cargo/registry""; /c/msys64/usr/bin/find cache -name \*.crate; fi"
- bash -c "if [ -d $USERPROFILE/.cargo/registry/src ]; then rm -r $USERPROFILE/.cargo/src; fi"
- bash -c "if [ -d $USERPROFILE/.cargo/registry/cache ]; then cd $USERPROFILE/.cargo/registry; find cache -name \*.crate; fi"
test_script:
- cargo +beta-%TARGET% clippy --all-targets --features "fail-on-warnings az f16 serde std"
@ -53,4 +54,4 @@ test_script:
- cargo +1.39.0-%TARGET% test --lib --features "fail-on-warnings az f16 serde"
after_test:
- C:\msys64\usr\bin\bash -c "if [ -d ""$USERPROFILE/.cargo/registry/cache"" ]; then cd ""$USERPROFILE/.cargo/registry""; /c/msys64/usr/bin/find cache -name \*.crate; fi"
- bash -c "if [ -d $USERPROFILE/.cargo/registry/cache ]; then cd $USERPROFILE/.cargo/registry; for c in cache/*/*.crate; do s=src/${c#cache/}; if [ ! -e ${s%.crate} ]; then rm -v $c; fi; done; find cache -name \*.crate; fi"

View File

@ -12,10 +12,11 @@ before_script:
- rustup toolchain install --profile minimal beta-$TARGET 1.39.0-$TARGET
- rustup component add --toolchain beta-$TARGET rustfmt clippy
- if [ -d cargo/registry/cache ]; then rm -rf $CARGO_HOME/registry/cache; mkdir -p $CARGO_HOME/registry; cp -R cargo/registry/cache $CARGO_HOME/registry/; echo Copied registry/cache; fi
- if [ -d $CARGO_HOME/registry/src ]; then rm -r $CARGO_HOME/registry/src; fi
- if [ -d $CARGO_HOME/registry/cache ]; then (cd $CARGO_HOME/registry; find cache -name \*.crate) fi
after_script:
- if [ -d $CARGO_HOME/registry/cache ]; then (cd $CARGO_HOME/registry; find cache -name \*.crate) fi
- if [ -d $CARGO_HOME/registry/cache ]; then (cd $CARGO_HOME/registry; for c in cache/*/*.crate; do s=src/${c#cache/}; if [ ! -e ${s%.crate} ]; then rm -v $c; fi; done; find cache -name \*.crate) fi
- rm -rf cargo
- mkdir -p cargo/registry
- if [ -d $CARGO_HOME/registry/cache ]; then cp -R $CARGO_HOME/registry/cache cargo/registry/; echo Updated registry/cache; fi