Travis CI在指定位置缓存单个文件 [英] Travis CI cache a single file at a specified location

查看:105
本文介绍了Travis CI在指定位置缓存单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Travis CI上构建一个Ruby项目,并使用Gemfile ans Bundler来管理依赖项。我的 .travis.yml 仅包含有关缓存的一行:

I am building a Ruby project on Travis CI and I use Gemfile ans Bundler to manage dependencies. My .travis.yml contains only one line about caching:

cache: bundler

而我在其他地方也依赖它(Travis的默认 install 命令,缓存目录,以及额外的捆绑清理,然后再上传缓存)。

And I rely on this in other places (Travis's default install command, cache directories, plus an extra bundle clean before uploading cache).

按默认情况下,不缓存 Gemfile.lock 。我想对其进行缓存,以使Bundler跳过依赖关系解析,并使用缓存的 Gemfile.lock 。我尚未找到有效的解决方案。

By default, Gemfile.lock is not cached. I want to cache it to make Bundler to skip dependency resolution and use the cached Gemfile.lock. I haven't found a valid solution for this.

有什么想法吗?

推荐答案

我注意到此问题下的唯一评论,并提出了一个想法,但我认为这是一种解决方法

I noticed the only comment under this question and came up with an idea, but I think it's more a workaround than a solution.

复制 Gemfile.lock 来自 / tmp / cached before_install 阶段。将 Gemfile.lock 复制到 中的 / tmp / cached before_script 阶段。这样,Travis CI将对其进行缓存,而Bundler将使用该缓存。

Copy Gemfile.lock from /tmp/cached in before_install phase. The copy Gemfile.lock to /tmp/cached in before_script phase. This way it'll be cached by Travis CI and the cache will be used by Bundler.

我仍在寻找真正的解决方案。

I'm still looking for a real solution.

这篇关于Travis CI在指定位置缓存单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆