Skip to content

Instantly share code, notes, and snippets.

@tsnow
Created December 10, 2013 18:11
Show Gist options
  • Save tsnow/7895228 to your computer and use it in GitHub Desktop.
Save tsnow/7895228 to your computer and use it in GitHub Desktop.
RC Travis test speed up ideas
cache:
- db/max_fixture_date
- db/max_script_date
- db/test_data_cache.sql
script: bundle exec rake db:test:from_travis_cache test
# lib/tasks/refresh_data.rake
namespace :db do
namespace :test do
task :from_travis_cache => ['db:load_from_cache', 'db:quick_refresh', 'db:migrate', 'db:cache_data']
end
task :load_from_cache do
`touch db/test_data_cache.sql;
mysql rc_test < db/test_data_cache.sql`
end
task :cache_data do
`mysqldump rc_test > db/test_data_cache_new.sql`
`if [[ “$(md5 -q db/test_data_cache_new.sql)” -ne “$(md5 -q db/test_data_cache.sql)” ]]; then
mv db/test_data_cache_new.sql db/test_data_cache.sql;
fi`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment