提交 8c315698 编写于 作者: M Mislav Marohnić

Merge branch 'travis-container' into 1.12-stable

sudo: false
language: ruby
before_install: before_install:
- sudo apt-get update -qq - script/bootstrap
- sudo apt-get install -qq tmux zsh git - export PATH=~/bin:"$PATH"
install: script/cached-bundle install --deployment --without development --jobs 3 --retry 3
script: script/test script: script/test
language: ruby bundler_args: --without development --deployment --jobs=3 --retry=3
cache: bundler
rvm: rvm:
- 1.8.7 - 1.8.7
- 1.9.2 - 1.9.2
- 1.9.3 - 1.9.3
- 2.0.0 - 2.0.0
- 2.1.0 - 2.1.5
notifications: notifications:
email: false email: false
env:
global:
- AMAZON_S3_BUCKET=ci-cache
- AMAZON_ACCESS_KEY_ID=AKIAJQCVTDEWQHRPBPGQ
- secure: "XAZv5xyNjWt7F9hG0MZhDANVJ5h/ajEZvfJOEIZRQlE3X5x6oVgI8blLh/MmlRSF0kIyLckcn6t2ccjSOvwN2hca5bwZSjIqoKbJyNe2cmkxfi2432vEOu3Ve6PT5hZWX4R5RgT+xWyMjIJcdF3gUMP7ErXl64aEncBzeW6OoXM="
...@@ -5,11 +5,10 @@ gem 'minitest' ...@@ -5,11 +5,10 @@ gem 'minitest'
gem 'aruba', '~> 0.5.3' gem 'aruba', '~> 0.5.3'
gem 'cucumber', '~> 1.3.9' gem 'cucumber', '~> 1.3.9'
gem 'sinatra' gem 'sinatra'
gem 'json' gem 'json', :platform => :ruby_18
gem 'jruby-openssl', :platform => :jruby gem 'jruby-openssl', :platform => :jruby
gem 'webmock', '~> 1.9.0' gem 'webmock', '~> 1.9.0'
group :development do group :development do
gem 'ronn', :platform => :mri gem 'ronn', :platform => :mri
gem 'ruby-prof'
end end
...@@ -28,7 +28,6 @@ GEM ...@@ -28,7 +28,6 @@ GEM
jruby-openssl (0.7.7) jruby-openssl (0.7.7)
bouncy-castle-java (>= 1.5.0146.1) bouncy-castle-java (>= 1.5.0146.1)
json (1.8.0) json (1.8.0)
json (1.8.0-java)
minitest (5.0.5) minitest (5.0.5)
multi_json (1.10.1) multi_json (1.10.1)
multi_test (0.1.1) multi_test (0.1.1)
...@@ -46,7 +45,6 @@ GEM ...@@ -46,7 +45,6 @@ GEM
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0) rspec-support (~> 3.0.0)
rspec-support (3.0.2) rspec-support (3.0.2)
ruby-prof (0.13.1)
sinatra (1.3.2) sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6) rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2) rack-protection (~> 1.2)
...@@ -68,6 +66,5 @@ DEPENDENCIES ...@@ -68,6 +66,5 @@ DEPENDENCIES
minitest minitest
rake (~> 10.1.1) rake (~> 10.1.1)
ronn ronn
ruby-prof
sinatra sinatra
webmock (~> 1.9.0) webmock (~> 1.9.0)
#!/usr/bin/env bash
set -e
if [ -n "$TRAVIS" ]; then
curl -fsSL https://ci-cache.s3.amazonaws.com/tmux-zsh.ubuntu.tgz | tar -xz -C ~
fi
#!/usr/bin/env bash
# Usage: cached-bundle install --deployment
#
# After running `bundle`, caches the `vendor/bundle` directory to S3.
# On the next run, restores the cached directory before running `bundle`.
# When `Gemfile.lock` changes, the cache gets rebuilt.
#
# Requirements:
# - Gemfile.lock
# - TRAVIS_REPO_SLUG
# - TRAVIS_RUBY_VERSION
# - AMAZON_S3_BUCKET
# - script/s3-put
# - bundle
# - curl
#
# Author: Mislav Marohnić
set -e
compute_md5() {
local output="$(openssl md5)"
echo "${output##* }"
}
download() {
curl --tcp-nodelay -qsfL "$1" -o "$2"
}
bundle_path="vendor/bundle"
gemfile_hash="$(compute_md5 <"${BUNDLE_GEMFILE:-Gemfile}.lock")"
cache_name="${TRAVIS_RUBY_VERSION}-${gemfile_hash}.tgz"
fetch_url="http://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${cache_name}"
if download "$fetch_url" "$cache_name"; then
echo "Reusing cached bundle ${cache_name}"
tar xzf "$cache_name"
fi
bundle "$@"
if [ ! -f "$cache_name" ] && [ -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}"
fi
#!/usr/bin/env bash
# Usage: s3-put <FILE> <S3_BUCKET>[:<PATH>] [<CONTENT_TYPE>]
#
# Uploads a file to the Amazon S3 service.
# Outputs the URL for the newly uploaded file.
#
# Requirements:
# - AMAZON_ACCESS_KEY_ID
# - AMAZON_SECRET_ACCESS_KEY
# - openssl
# - curl
#
# Author: Mislav Marohnić
set -e
authorization() {
local signature="$(string_to_sign | hmac_sha1 | base64)"
echo "AWS ${AMAZON_ACCESS_KEY_ID?}:${signature}"
}
hmac_sha1() {
openssl dgst -binary -sha1 -hmac "${AMAZON_SECRET_ACCESS_KEY?}"
}
base64() {
openssl enc -base64
}
bin_md5() {
openssl dgst -binary -md5
}
string_to_sign() {
echo "$http_method"
echo "$content_md5"
echo "$content_type"
echo "$date"
echo "x-amz-acl:$acl"
printf "/$bucket/$remote_path"
}
date_string() {
LC_TIME=C date "+%a, %d %h %Y %T %z"
}
file="$1"
bucket="${2%%:*}"
remote_path="${2#*:}"
content_type="$3"
if [ -z "$remote_path" ] || [ "$remote_path" = "$bucket" ]; then
remote_path="${file##*/}"
fi
http_method=PUT
acl="public-read"
content_md5="$(bin_md5 < "$file" | base64)"
date="$(date_string)"
url="https://$bucket.s3.amazonaws.com/$remote_path"
curl -qsSf -T "$file" \
-H "Authorization: $(authorization)" \
-H "x-amz-acl: $acl" \
-H "Date: $date" \
-H "Content-MD5: $content_md5" \
-H "Content-Type: $content_type" \
"$url"
echo "$url"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册