Skip to content

Commit

Permalink
Improve travis build.
Browse files Browse the repository at this point in the history
- No need to install bundler twice.
- No need to bundle install twice.
- Skip one-by-one specs on JRuby.
- Run cucumber using our standalone bundle
  (rather than bundle exec).
- Bundler issue #2383 has been resolved,
  no need to work around it anymore.
  • Loading branch information
myronmarston committed Aug 23, 2013
1 parent 590a19e commit c87781b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
@@ -1,5 +1,3 @@
before_install:
- gem install bundler
bundler_args: "--binstubs --standalone --without documentation"
script: "script/test_all"
rvm:
Expand Down
33 changes: 20 additions & 13 deletions script/test_all
Expand Up @@ -2,8 +2,13 @@

set -e -x

# Needed by Bundler 1.3: https://github.com/carlhuda/bundler/issues/2382
export RUBYOPT='-rrbconfig'
function is_jruby() {
if ruby -e 'exit RUBY_PLATFORM == "java"'; then
return 0
else
return 1
fi
}

# idea taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html
export JRUBY_OPTS='-X-C' # disable JIT since these processes are so short lived
Expand All @@ -12,22 +17,24 @@ export JRUBY_OPTS='-X-C' # disable JIT since these processes are so short lived
# idea taken from https://github.com/jruby/jruby/wiki/Improving-startup-time
export JAVA_OPTS='-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1'

echo "Bundling Standalone so we can run the specs w/o bundler loaded"
bundle install --standalone --binstubs

echo "Running all..."
bin/rspec spec --format progress --profile

echo
echo "--------------------------------------------------------------------"
echo

for file in `find spec -iname '*_spec.rb'`; do
NO_COVERALLS=1 bin/rspec $file --format progress
done
if is_jruby; then
echo "Skipping one-by-one spec runs due to expensive JVM load time"
else
for file in `find spec -iname '*_spec.rb'`; do
NO_COVERALLS=1 bin/rspec $file -b --format progress
done
fi

# 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" \
PATH="${PWD}/bin:$PATH" \
bin/cucumber --strict

# TODO: it would be nice to figure out how to run the cukes w/o the overhead of
# bundler, but just running `bin/cucumber` can fail due to the fact that it
# shells out (via aruba) and executes `rspec`--which can pick up the wrong
# rspec version if we're not running with bundler.
bundle exec cucumber --strict

0 comments on commit c87781b

Please sign in to comment.