@@ -1,18 +1,14 @@ |
||
1 |
+sudo: false |
|
1 | 2 |
language: ruby |
2 | 3 |
env: |
3 | 4 |
matrix: |
4 | 5 |
- APP_SECRET_TOKEN=b2724973fd81c2f4ac0f92ac48eb3f0152c4a11824c122bcf783419a4c51d8b9bba81c8ba6a66c7de599677c7f486242cf819775c433908e77c739c5c8ae118d |
5 |
- global: |
|
6 |
- - AMAZON_S3_BUCKET=huginn-bundle-cache |
|
7 |
- - AMAZON_ACCESS_KEY_ID=AKIAITMDBT3BL3ZWVFGA |
|
8 |
- - secure: JbDX6yVP+Q32FOl7UmB7bBxaEGDNYd3IlfDACmdRHkf23yRa4RvQD1U1Gu8kh8c5Els2VvzUWEkv7VjJWNgxVJFnbGbqbnIrbdEhGMTwXnJjpuzAx2+TWuXUEGFeZVqtNqtxSW1r/CCAFYtWpnX0jW27wLQvRitY1r/BqiXXDgc= |
|
9 | 6 |
rvm: |
10 | 7 |
- 2.0.0 |
11 |
-- 2.1.4 |
|
8 |
+- 2.1.5 |
|
12 | 9 |
- 1.9.3 |
13 |
-before_install: |
|
14 |
-- travis_retry gem install bundler |
|
15 |
-install: travis_retry script/cached-bundle install --without development production --deployment |
|
10 |
+cache: bundler |
|
11 |
+bundler_args: --without development production |
|
16 | 12 |
before_script: |
17 | 13 |
- mysql -e 'create database huginn_test;' |
18 | 14 |
- bundle exec rake db:migrate db:test:prepare |
@@ -1,47 +0,0 @@ |
||
1 |
-#!/usr/bin/env bash |
|
2 |
-# Usage: cached-bundle install --deployment |
|
3 |
-# |
|
4 |
-# After running `bundle`, caches the `vendor/bundle` directory to S3. |
|
5 |
-# On the next run, restores the cached directory before running `bundle`. |
|
6 |
-# When `Gemfile.lock` changes, the cache gets rebuilt. |
|
7 |
-# |
|
8 |
-# Requirements: |
|
9 |
-# - Gemfile.lock |
|
10 |
-# - TRAVIS_REPO_SLUG |
|
11 |
-# - TRAVIS_RUBY_VERSION |
|
12 |
-# - AMAZON_S3_BUCKET |
|
13 |
-# - script/s3-put |
|
14 |
-# - bundle |
|
15 |
-# - curl |
|
16 |
-# |
|
17 |
-# Author: Mislav Marohnić |
|
18 |
- |
|
19 |
-set -e |
|
20 |
- |
|
21 |
-compute_md5() { |
|
22 |
- local output="$(openssl md5)" |
|
23 |
- echo "${output##* }" |
|
24 |
-} |
|
25 |
- |
|
26 |
-download() { |
|
27 |
- curl --tcp-nodelay -qsfL "$1" -o "$2" |
|
28 |
-} |
|
29 |
- |
|
30 |
-bundle_path="vendor/bundle" |
|
31 |
-gemfile_hash="$(compute_md5 <"${BUNDLE_GEMFILE:-Gemfile}.lock")" |
|
32 |
-#cache_name="${TRAVIS_RUBY_VERSION}-${gemfile_hash}.tgz" |
|
33 |
-cache_name="${TRAVIS_RUBY_VERSION}.tgz" |
|
34 |
-fetch_url="http://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${cache_name}" |
|
35 |
- |
|
36 |
-if download "$fetch_url" "$cache_name"; then |
|
37 |
- echo "Reusing cached bundle ${cache_name}" |
|
38 |
- tar xzf "$cache_name" |
|
39 |
-fi |
|
40 |
- |
|
41 |
-bundle "$@" |
|
42 |
- |
|
43 |
-if [ ! -f "$cache_name" ]; then |
|
44 |
- echo "Caching \`${bundle_path}' to S3" |
|
45 |
- tar czf "$cache_name" "$bundle_path" |
|
46 |
- script/s3-put "$cache_name" "${AMAZON_S3_BUCKET}:${cache_name}" |
|
47 |
-fi |
@@ -1,71 +0,0 @@ |
||
1 |
-#!/usr/bin/env bash |
|
2 |
-# Usage: s3-put <FILE> <S3_BUCKET>[:<PATH>] [<CONTENT_TYPE>] |
|
3 |
-# |
|
4 |
-# Uploads a file to the Amazon S3 service. |
|
5 |
-# Outputs the URL for the newly uploaded file. |
|
6 |
-# |
|
7 |
-# Requirements: |
|
8 |
-# - AMAZON_ACCESS_KEY_ID |
|
9 |
-# - AMAZON_SECRET_ACCESS_KEY |
|
10 |
-# - openssl |
|
11 |
-# - curl |
|
12 |
-# |
|
13 |
-# Author: Mislav Marohnić |
|
14 |
- |
|
15 |
-set -e |
|
16 |
- |
|
17 |
-authorization() { |
|
18 |
- local signature="$(string_to_sign | hmac_sha1 | base64)" |
|
19 |
- echo "AWS ${AMAZON_ACCESS_KEY_ID?}:${signature}" |
|
20 |
-} |
|
21 |
- |
|
22 |
-hmac_sha1() { |
|
23 |
- openssl dgst -binary -sha1 -hmac "${AMAZON_SECRET_ACCESS_KEY?}" |
|
24 |
-} |
|
25 |
- |
|
26 |
-base64() { |
|
27 |
- openssl enc -base64 |
|
28 |
-} |
|
29 |
- |
|
30 |
-bin_md5() { |
|
31 |
- openssl dgst -binary -md5 |
|
32 |
-} |
|
33 |
- |
|
34 |
-string_to_sign() { |
|
35 |
- echo "$http_method" |
|
36 |
- echo "$content_md5" |
|
37 |
- echo "$content_type" |
|
38 |
- echo "$date" |
|
39 |
- echo "x-amz-acl:$acl" |
|
40 |
- printf "/$bucket/$remote_path" |
|
41 |
-} |
|
42 |
- |
|
43 |
-date_string() { |
|
44 |
- LC_TIME=C date "+%a, %d %h %Y %T %z" |
|
45 |
-} |
|
46 |
- |
|
47 |
-file="$1" |
|
48 |
-bucket="${2%%:*}" |
|
49 |
-remote_path="${2#*:}" |
|
50 |
-content_type="$3" |
|
51 |
- |
|
52 |
-if [ -z "$remote_path" ] || [ "$remote_path" = "$bucket" ]; then |
|
53 |
- remote_path="${file##*/}" |
|
54 |
-fi |
|
55 |
- |
|
56 |
-http_method=PUT |
|
57 |
-acl="public-read" |
|
58 |
-content_md5="$(bin_md5 < "$file" | base64)" |
|
59 |
-date="$(date_string)" |
|
60 |
- |
|
61 |
-url="https://$bucket.s3.amazonaws.com/$remote_path" |
|
62 |
- |
|
63 |
-curl -qsSf -T "$file" \ |
|
64 |
- -H "Authorization: $(authorization)" \ |
|
65 |
- -H "x-amz-acl: $acl" \ |
|
66 |
- -H "Date: $date" \ |
|
67 |
- -H "Content-MD5: $content_md5" \ |
|
68 |
- -H "Content-Type: $content_type" \ |
|
69 |
- "$url" |
|
70 |
- |
|
71 |
-echo "$url" |