From ff27a6fc64e3f4f10fd0608c27d942c025fd65b9 Mon Sep 17 00:00:00 2001 From: Louis Capitanchik Date: Wed, 6 Apr 2016 05:52:11 +0100 Subject: [PATCH 1/6] using rust-everywhere deploy script --- .travis.yml | 56 ++++++++++++++++++++++++----- ci/before_deploy.sh | 30 ++++++++++++++++ ci/install.sh | 88 +++++++++++++++++++++++++++++++++++++++++++++ ci/script.sh | 51 ++++++++++++++++++++++++++ 4 files changed, 217 insertions(+), 8 deletions(-) create mode 100644 ci/before_deploy.sh create mode 100644 ci/install.sh create mode 100644 ci/script.sh diff --git a/.travis.yml b/.travis.yml index 7f1b897..ce2dfe9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,49 @@ -language: rust -rust: - - stable - - beta - - nightly +language: generic + +env: + global: + - PROJECT_NAME=moka matrix: - allow_failures: - - rust: stable - - rust: beta + include: + # Nightly channel + - os: osx + env: TARGET=i686-apple-darwin CHANNEL=nightly + - os: linux + env: TARGET=i686-unknown-linux-gnu CHANNEL=nightly + addons: + apt: + packages: *i686_unknown_linux_gnu + - os: osx + env: TARGET=x86_64-apple-darwin CHANNEL=nightly + - os: linux + env: TARGET=x86_64-unknown-linux-gnu CHANNEL=nightly + - os: linux + env: TARGET=x86_64-unknown-linux-musl CHANNEL=nightly + +install: + - export PATH="$PATH:~/multirust/bin" + - bash ci/install.sh + +script: + - bash ci/script.sh + +before_deploy: + - bash ci/before_deploy.sh + +deploy: + provider: releases + api_key: + secure: EDs8uEktG84eUM6afVqAHB7QVpx86rb2ZHM9kJEx1AjaBOs5ytJk5nnL7/dosBSEHG3FI0+oKt6n2dXeRCymPXMgU8GE9lgwRuzDsEA3H9yr3zmqbm4uplhwduVi5qK4oM5pWuOutofi4eEa8SiTIA5taMRujXwHFjDDswucJbePSxm6ioU/m7c3fh4eUMUrvHHpJqBJ9+kvZSP9e2KlU0f/WxQtAe/568tk/HLAdD3Eo9SLnVvL/etA8zyBBgUo2XV4R+J4sBho6SFQxhQBI3sHcTwq51iELNGnkQwgxtwSsm2CuhfrYEaO1R94cWtAt+2AH6RScP/scN8O772ab7FengvomDYvDYjO21mCK9GSMqRRLPtBoSa+KcYG+58EqCPoyaNOttYOMI3LJEQq6AyaEsYO1jt1SvqT114u8iN6lrVUrnRuJI1n9gdUOgl6z1rHJh8Rlo80oQWftWm9PXhnol7CQoHzB/V1IQDksM4eVksdZBo7tSdQjFChu21jaS4xWmssCs21kodT3htCfNV4lc1PQH4CuPHfTzES3pkssq8g8m6NOWjpShvhA/LCJVK7fuyi5gICCc3YY8slaIRXg0P8D0JykJH/aAkEKJpqeTnrKiW3t1L9ZIYzBijkyKJHxrvun3+ECkE5dHNoD4SlOiCxLjF3s3aYf1oX6aM= + file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz + skip_cleanup: true + on: + # channel to use to produce the release artifacts + # NOTE make sure you only release *once* per target + # TODO you may want to pick a different channel + condition: $CHANNEL = nightly + tags: true + +#branches: +# only: +# - master +# - /^v\d+\.\d+\.\d+.*$/ \ No newline at end of file diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh new file mode 100644 index 0000000..a46b22c --- /dev/null +++ b/ci/before_deploy.sh @@ -0,0 +1,30 @@ +set -ex + +mktempd() { + echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp) +} + +mk_artifacts() { + cargo build --target $TARGET --release +} + +mk_tarball() { + local temp_dir=$(mktempd) + local out_dir=$(pwd) + + cp target/$TARGET/release/moka $temp_dir + + pushd $temp_dir + + tar czf $out_dir/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz * + + popd $temp_dir + rm -r $temp_dir +} + +main() { + mk_artifacts + mk_tarball +} + +main diff --git a/ci/install.sh b/ci/install.sh new file mode 100644 index 0000000..5aa6928 --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,88 @@ +set -ex + +mktempd() { + echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp) +} + +install_multirust() { + local temp_dir=$(mktempd) + + git clone https://github.com/brson/multirust $temp_dir + + pushd $temp_dir + ./build.sh + ./install.sh --prefix=~/multirust + + multirust default $CHANNEL + rustc -V + cargo -V + + popd + rm -rf $temp_dir +} + +install_standard_crates() { + local host + case "$TRAVIS_OS_NAME" in + linux) + host=x86_64-unknown-linux-gnu + ;; + osx) + host=x86_64-apple-darwin + ;; + esac + + if [ "$host" != "$TARGET" ]; then + if [ "$CHANNEL" = "nightly" ]; then + multirust add-target nightly $TARGET + else + local version + if [ "$CHANNEL" = "stable" ]; then + # e.g. 1.6.0 + version=$(rustc -V | cut -d' ' -f2) + else + version=beta + fi + + local tarball=rust-std-${version}-${TARGET} + + local temp_dir=$(mktempd) + curl -s https://static.rust-lang.org/dist/${tarball}.tar.gz | \ + tar --strip-components 1 -C $temp_dir -xz + + $temp_dir/install.sh --prefix=$(rustc --print sysroot) + + rm -r $temp_dir + fi + fi +} + +configure_cargo() { + local prefix= + case "$TARGET" in + arm*-gnueabihf) + prefix=arm-linux-gnueabihf + ;; + *) + return + ;; + esac + + # information about the cross compiler + $prefix-gcc -v + + # tell cargo which linker to use for cross compilation + mkdir -p .cargo + cat >>.cargo/config < Date: Wed, 6 Apr 2016 06:05:03 +0100 Subject: [PATCH 2/6] Pruned most of travis.yml --- .travis.yml | 33 ++++----------------------------- ci/before_deploy.sh | 2 ++ 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index ce2dfe9..74438f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,10 @@ -language: generic +language: rust +rust: + - nightly env: global: - PROJECT_NAME=moka -matrix: - include: - # Nightly channel - - os: osx - env: TARGET=i686-apple-darwin CHANNEL=nightly - - os: linux - env: TARGET=i686-unknown-linux-gnu CHANNEL=nightly - addons: - apt: - packages: *i686_unknown_linux_gnu - - os: osx - env: TARGET=x86_64-apple-darwin CHANNEL=nightly - - os: linux - env: TARGET=x86_64-unknown-linux-gnu CHANNEL=nightly - - os: linux - env: TARGET=x86_64-unknown-linux-musl CHANNEL=nightly - -install: - - export PATH="$PATH:~/multirust/bin" - - bash ci/install.sh - -script: - - bash ci/script.sh before_deploy: - bash ci/before_deploy.sh @@ -37,13 +16,9 @@ deploy: file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz skip_cleanup: true on: - # channel to use to produce the release artifacts - # NOTE make sure you only release *once* per target - # TODO you may want to pick a different channel - condition: $CHANNEL = nightly tags: true #branches: # only: # - master -# - /^v\d+\.\d+\.\d+.*$/ \ No newline at end of file +# - /^v\d+\.\d+\.\d+.*$/ diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh index a46b22c..fdefa36 100644 --- a/ci/before_deploy.sh +++ b/ci/before_deploy.sh @@ -12,6 +12,8 @@ mk_tarball() { local temp_dir=$(mktempd) local out_dir=$(pwd) + echo $("ls target/$target/release") + cp target/$TARGET/release/moka $temp_dir pushd $temp_dir From 893cad96fd71664c3d1959457cc7f2cea3e30b6a Mon Sep 17 00:00:00 2001 From: Louis Capitanchik Date: Wed, 6 Apr 2016 06:11:05 +0100 Subject: [PATCH 3/6] Removed references to missing variable --- ci/before_deploy.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh index fdefa36..bcd96be 100644 --- a/ci/before_deploy.sh +++ b/ci/before_deploy.sh @@ -5,20 +5,21 @@ mktempd() { } mk_artifacts() { - cargo build --target $TARGET --release + cargo build --release } mk_tarball() { local temp_dir=$(mktempd) local out_dir=$(pwd) - echo $("ls target/$target/release") + echo $("ls target/release") - cp target/$TARGET/release/moka $temp_dir + cp target/release/moka $temp_dir + cp target/release/resources $temp_dir/resources pushd $temp_dir - tar czf $out_dir/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz * + tar czf $out_dir/${PROJECT_NAME}-${TRAVIS_TAG}-x64-linux.tar.gz * popd $temp_dir rm -r $temp_dir From c264597e5f764a396b603314b6d7cf63b221b467 Mon Sep 17 00:00:00 2001 From: Louis Capitanchik Date: Wed, 6 Apr 2016 06:17:02 +0100 Subject: [PATCH 4/6] More tweaking. ls in pre-deploy and renamed target in travis.yml --- .travis.yml | 2 +- ci/before_deploy.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74438f1..0ab0134 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ deploy: provider: releases api_key: secure: EDs8uEktG84eUM6afVqAHB7QVpx86rb2ZHM9kJEx1AjaBOs5ytJk5nnL7/dosBSEHG3FI0+oKt6n2dXeRCymPXMgU8GE9lgwRuzDsEA3H9yr3zmqbm4uplhwduVi5qK4oM5pWuOutofi4eEa8SiTIA5taMRujXwHFjDDswucJbePSxm6ioU/m7c3fh4eUMUrvHHpJqBJ9+kvZSP9e2KlU0f/WxQtAe/568tk/HLAdD3Eo9SLnVvL/etA8zyBBgUo2XV4R+J4sBho6SFQxhQBI3sHcTwq51iELNGnkQwgxtwSsm2CuhfrYEaO1R94cWtAt+2AH6RScP/scN8O772ab7FengvomDYvDYjO21mCK9GSMqRRLPtBoSa+KcYG+58EqCPoyaNOttYOMI3LJEQq6AyaEsYO1jt1SvqT114u8iN6lrVUrnRuJI1n9gdUOgl6z1rHJh8Rlo80oQWftWm9PXhnol7CQoHzB/V1IQDksM4eVksdZBo7tSdQjFChu21jaS4xWmssCs21kodT3htCfNV4lc1PQH4CuPHfTzES3pkssq8g8m6NOWjpShvhA/LCJVK7fuyi5gICCc3YY8slaIRXg0P8D0JykJH/aAkEKJpqeTnrKiW3t1L9ZIYzBijkyKJHxrvun3+ECkE5dHNoD4SlOiCxLjF3s3aYf1oX6aM= - file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz + file: ${PROJECT_NAME}-${TRAVIS_TAG}-x64-linux.tar.gz skip_cleanup: true on: tags: true diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh index bcd96be..8c6b06b 100644 --- a/ci/before_deploy.sh +++ b/ci/before_deploy.sh @@ -12,10 +12,12 @@ mk_tarball() { local temp_dir=$(mktempd) local out_dir=$(pwd) - echo $("ls target/release") + ls . + ls target + ls target/release cp target/release/moka $temp_dir - cp target/release/resources $temp_dir/resources + cp -r target/release/resources/* $temp_dir/resources pushd $temp_dir From 8e66a3838b24a9cb10bb9fc6f062f012fba7f113 Mon Sep 17 00:00:00 2001 From: Louis Capitanchik Date: Wed, 6 Apr 2016 06:21:50 +0100 Subject: [PATCH 5/6] Removed ls, added mkdir for tmp resources --- ci/before_deploy.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh index 8c6b06b..43c484b 100644 --- a/ci/before_deploy.sh +++ b/ci/before_deploy.sh @@ -12,11 +12,8 @@ mk_tarball() { local temp_dir=$(mktempd) local out_dir=$(pwd) - ls . - ls target - ls target/release - cp target/release/moka $temp_dir + mkdir $temp_dir/resources cp -r target/release/resources/* $temp_dir/resources pushd $temp_dir From e7537afa555672b867f508d317fcee9f961d9a60 Mon Sep 17 00:00:00 2001 From: Louis Capitanchik Date: Wed, 6 Apr 2016 06:28:50 +0100 Subject: [PATCH 6/6] Removed files no longer used --- ci/install.sh | 88 --------------------------------------------------- ci/script.sh | 51 ----------------------------- 2 files changed, 139 deletions(-) delete mode 100644 ci/install.sh delete mode 100644 ci/script.sh diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 5aa6928..0000000 --- a/ci/install.sh +++ /dev/null @@ -1,88 +0,0 @@ -set -ex - -mktempd() { - echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp) -} - -install_multirust() { - local temp_dir=$(mktempd) - - git clone https://github.com/brson/multirust $temp_dir - - pushd $temp_dir - ./build.sh - ./install.sh --prefix=~/multirust - - multirust default $CHANNEL - rustc -V - cargo -V - - popd - rm -rf $temp_dir -} - -install_standard_crates() { - local host - case "$TRAVIS_OS_NAME" in - linux) - host=x86_64-unknown-linux-gnu - ;; - osx) - host=x86_64-apple-darwin - ;; - esac - - if [ "$host" != "$TARGET" ]; then - if [ "$CHANNEL" = "nightly" ]; then - multirust add-target nightly $TARGET - else - local version - if [ "$CHANNEL" = "stable" ]; then - # e.g. 1.6.0 - version=$(rustc -V | cut -d' ' -f2) - else - version=beta - fi - - local tarball=rust-std-${version}-${TARGET} - - local temp_dir=$(mktempd) - curl -s https://static.rust-lang.org/dist/${tarball}.tar.gz | \ - tar --strip-components 1 -C $temp_dir -xz - - $temp_dir/install.sh --prefix=$(rustc --print sysroot) - - rm -r $temp_dir - fi - fi -} - -configure_cargo() { - local prefix= - case "$TARGET" in - arm*-gnueabihf) - prefix=arm-linux-gnueabihf - ;; - *) - return - ;; - esac - - # information about the cross compiler - $prefix-gcc -v - - # tell cargo which linker to use for cross compilation - mkdir -p .cargo - cat >>.cargo/config <