diff --git a/.travis.yml b/.travis.yml index b6d7f6d..b87048d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -cache: cargo dist: trusty language: generic language: rust @@ -59,7 +58,6 @@ install: fi script: - # chmod: Travis can't cache files that are not readable by "others" # NOTE(TRAVIS_BRANCH) See the NOTE in the `install` section - if [ -z $TRAVIS_TAG ] && [ $TRAVIS_BRANCH != master ] || [ $TRAVIS_EVENT_TYPE = cron ]; then cargo generate-lockfile; @@ -70,11 +68,10 @@ script: sh ci/run.sh || exit 1; fi; - chmod -R a+r $HOME/.cargo; fi before_deploy: - - sh ci/package.sh $TARGET + - sh ci/before_deploy.sh deploy: provider: releases @@ -88,10 +85,9 @@ deploy: condition: $TRAVIS_RUST_VERSION = $DEPLOY_VERSION tags: true -cache: - directories: - - $HOME/.cargo - - target +cache: cargo +before_cache: + - chmod -R a+r $HOME/.cargo; branches: only: diff --git a/ci/package.sh b/ci/before_deploy.sh similarity index 84% rename from ci/package.sh rename to ci/before_deploy.sh index e1d4f4c..ca83ecd 100644 --- a/ci/package.sh +++ b/ci/before_deploy.sh @@ -1,6 +1,6 @@ set -ex -run() { +main() { local src_dir=$(pwd)\ stage= @@ -13,6 +13,7 @@ run() { ;; esac + cargo rustc --target $TARGET --release -- -C lto cp target/$TARGET/release/xargo $stage/ cd $stage @@ -22,4 +23,4 @@ run() { rm -rf $stage } -run +main diff --git a/ci/run.sh b/ci/run.sh index 86f4491..5d9e688 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -1,6 +1,6 @@ set -ex -test_mode() { +main() { cargo build --target $TARGET cargo run --target $TARGET -- -V @@ -10,16 +10,4 @@ test_mode() { fi } -deploy_mode() { - cargo rustc --target $TARGET --release -- -C lto -} - -run() { - if [ -z $TRAVIS_TAG ]; then - test_mode - elif [ $TRAVIS_RUST_VERSION = $DEPLOY_VERSION ]; then - deploy_mode - fi -} - -run +main