Skip to content

Commit

Permalink
fix deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Dec 30, 2016
1 parent 6c3f7f0 commit a6bb42a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cache: cargo
dist: trusty
language: generic
language: rust
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions ci/package.sh → ci/before_deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set -ex

run() {
main() {
local src_dir=$(pwd)\
stage=

Expand All @@ -13,6 +13,7 @@ run() {
;;
esac

cargo rustc --target $TARGET --release -- -C lto
cp target/$TARGET/release/xargo $stage/

cd $stage
Expand All @@ -22,4 +23,4 @@ run() {
rm -rf $stage
}

run
main
16 changes: 2 additions & 14 deletions ci/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set -ex

test_mode() {
main() {
cargo build --target $TARGET
cargo run --target $TARGET -- -V

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

0 comments on commit a6bb42a

Please sign in to comment.