From d1cb6d7d128e99c01d6cf85ba0dbfddb57b063cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sun, 21 Aug 2016 15:57:31 +0200 Subject: [PATCH] Simplify Travis config and fix release process --- .travis.yml | 8 +------- script/bootstrap | 9 ++++++--- script/cached-bundle | 6 ++++-- script/publish-release | 3 ++- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index eeb9ebcf..6ff6e8cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,14 @@ -os: - - linux - - osx sudo: false before_install: - export BUNDLE_GEMFILE=$PWD/Gemfile - export TRAVIS_RUBY_VERSION="$(ruby -e 'puts RUBY_VERSION')-travis" - - script/bootstrap - export PATH=~/bin:"$PATH" language: go go: - 1.6.3 script: make test-all -install: script/cached-bundle install --without development --deployment --jobs=3 --retry=3 +install: script/bootstrap after_success: script/publish-release -notifications: - email: false env: global: - AMAZON_S3_BUCKET=ci-cache diff --git a/script/bootstrap b/script/bootstrap index c8ee6ef5..c73a5a2b 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -if [ -n "$TRAVIS" ]; then +if [ -n "$TRAVIS" ] && [ ! -x ~/bin/tmux ]; then case "$TRAVIS_OS_NAME" in linux ) cache_name="tmux-zsh.ubuntu" ;; osx ) cache_name="tmux.osx" ;; @@ -12,7 +12,6 @@ if [ -n "$TRAVIS" ]; then esac curl -fsSL "https://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${cache_name}.tgz" | tar -xz -C ~ - exit 0 fi STATUS=0 @@ -23,7 +22,11 @@ if ! go version; then fi { ruby --version - bundle install --path vendor/bundle + if [ -n "$TRAVIS" ]; then + script/cached-bundle install --deployment --jobs=3 --retry=3 + else + bundle install --path vendor/bundle + fi bundle binstub cucumber ronn --path bin } || { echo "You need Ruby 1.9 or higher and Bundler to run hub tests" >&2 diff --git a/script/cached-bundle b/script/cached-bundle index 23963cf9..85d3504d 100755 --- a/script/cached-bundle +++ b/script/cached-bundle @@ -31,15 +31,17 @@ bundle_path="vendor/bundle" gemfile_hash="$(compute_md5 <"${BUNDLE_GEMFILE:-Gemfile}.lock")" cache_name="${TRAVIS_RUBY_VERSION}-${gemfile_hash}.${TRAVIS_OS_NAME}.tgz" fetch_url="http://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${cache_name}" +bundle_log="$(mktemp /tmp/bundle.XXXX)" if download "$fetch_url" "$cache_name"; then echo "Reusing cached bundle ${cache_name}" tar xzf "$cache_name" fi -bundle "$@" +set -o pipefail +bundle "$@" | tee "$bundle_log" -if [ ! -f "$cache_name" ] && [ -n "$AMAZON_SECRET_ACCESS_KEY" ]; then +if grep -q '^Installing' "$bundle_log" && [ -n "$AMAZON_SECRET_ACCESS_KEY" ]; then echo "Caching \`${bundle_path}' to S3" tar czf "$cache_name" "$bundle_path" script/s3-put "$cache_name" "${AMAZON_S3_BUCKET}:${TRAVIS_REPO_SLUG}/${cache_name}" diff --git a/script/publish-release b/script/publish-release index 14bbf529..8e477130 100755 --- a/script/publish-release +++ b/script/publish-release @@ -4,5 +4,6 @@ set -e if [[ $TRAVIS_TAG == v* ]] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ -n "$GITHUB_OAUTH" ]; then version="${TRAVIS_TAG#v}" make man-pages - script/cross-compile "$version" | script/github-release hub "$version" + script/cross-compile "$version" | \ + PATH="bin:$PATH" script/github-release hub "$version" fi -- GitLab