Skip to content

Commit

Permalink
Attempt to cache bundles for all repos.
Browse files Browse the repository at this point in the history
I discovered that the reason travis wasn’t caching
them is because it run `bundle clean` at the end just
before caching the bundle, which removes the gems needed
by the other repos. By having a separate bundle for
each repo, each cached, we can get travis to cache them all.

For #101.
  • Loading branch information
myronmarston committed Jan 1, 2015
1 parent 1088f85 commit c20ecac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
10 changes: 8 additions & 2 deletions travis/.travis.yml
@@ -1,12 +1,18 @@
language: ruby
sudo: false
cache: bundler
cache:
directories:
- ../rspec-core/bundle
- ../rspec-expectations/bundle
- ../rspec-mocks/bundle
- ../rspec-rails/bundle
- ../rspec-support/bundle
before_install:
- "script/clone_all_rspec_repos"
# Downgrade bundler to work around https://github.com/bundler/bundler/issues/3004
# Note this doesn't work on JRUBY 2.0.0 mode so we don't do it
- if [ -z "$JRUBY_OPTS" ]; then gem install bundler -v=1.5.3 && alias bundle="bundle _1.5.3_"; fi
bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
bundler_args: "--binstubs --standalone --without documentation --path bundle"
script: "script/run_build"
rvm:
- 1.8.7
Expand Down
14 changes: 11 additions & 3 deletions travis/script/functions.sh
Expand Up @@ -8,8 +8,15 @@ SPECS_HAVE_RUN_FILE=specs.out
MAINTENANCE_BRANCH=`cat maintenance-branch`

function clone_repo {
if [ ! -d $1 ]; then # don't clone if the dir is already there
travis_retry eval "git clone git://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH"
if [ ! -e $1/Gemfile ]; then # don't reclone
# deal with our bundler cache directory.
# Git won't clone into a non-empty dir so we have to move it aside and move it back.
mkdir -p $1/bundle
pushd $1
mv bundle ../$1-bundle
travis_retry eval "git clone git://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH ."
mv ../$1-bundle bundle
popd
fi;
}

Expand Down Expand Up @@ -45,7 +52,7 @@ function run_cukes {
else
# Prepare RUBYOPT for scenarios that are shelling out to ruby,
# and PATH for those that are using `rspec` or `rake`.
RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \
RUBYOPT="-I${PWD}/bundle -rbundler/setup" \
PATH="${PWD}/bin:$PATH" \
bin/cucumber --strict
fi
Expand All @@ -68,6 +75,7 @@ function run_spec_suite_for {
bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
travis_retry eval "bundle install $bundle_install_flags"
run_specs_and_record_done
bundle clean # prep for travis caching
popd
fi;
}
Expand Down

0 comments on commit c20ecac

Please sign in to comment.