我将 gitlab.com 和 CI 与共享 docker 运行程序一起使用,该运行程序在每次提交到 master 时为我的 Ruby on Rails 项目运行测试。我注意到大约 90% 的构建时间都花在了“捆绑安装”上。是否可以在提交之间以某种方式缓存已安装的 gem 以加快“捆绑安装”?
更新:
更具体地说,下面是我的 .gitlab-ci.yml 的内容。'test' 脚本的前 3 行大约需要 90% 的时间使构建运行 4-5 分钟。
image: ruby:2.2.4
services:
- postgres
test:
script:
- apt-get update -qy
- apt-get install -y nodejs
- bundle install --path /cache
- bundle exec rake db:drop db:create db:schema:load RAILS_ENV=test
- bundle exec rspec