Cache Brew使用travis ci构建 [英] Cache Brew builds with travis ci

查看:75
本文介绍了Cache Brew使用travis ci构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Travis CI osx构建,该构建具有brew依赖关系,必须从源代码构建.

I have a Travis CI osx build with a brew dependency that has to be built from source.

我知道Travis具有cache功能,但是它没有有关如何缓存brew构建或输出的任何文档.

I know that Travis has the cache feature, but it doesn't have any documentation on how to cache brew builds or outputs.

关于如何在travis中缓存brew程序包的任何想法?

Any idea on how to cache a brew package in travis?

推荐答案

此处存在3个独立的,松散相关的问题:

  • 缓存下载的瓶子
  • 缓存本地制造的瓶子
  • 缓存自制的元数据
  • Cache downloaded bottles
  • Cache locally-built bottles
  • Cache Homebrew metadata

您不一定需要全部三个,所以请遵循适合您需要的任何部分.

You don't necessarily need all three, so follow whichever sections fit your needs.

  • $HOME/Library/Caches/Homebrew添加到Travis的缓存(实际上,应该使用brew --cache检索此路径,但是您不能在这里调用它)

  • Add $HOME/Library/Caches/Homebrew to Travis' cache (actually, this path is supposed to be retrieved with brew --cache but you can't call it here, can you)

cache:
  directories:
    - $HOME/Library/Caches/Homebrew

  • before_cache阶段运行brew cleanup-否则,随着新软件包版本的发布,缓存将无限期增长

  • Run brew cleanup at before_cache stage -- otherwise, the cache will grow indefinitely as new package versions are released

    before_cache:
      - brew cleanup
    

  • 完整代码太长,无法在此处列出因此给出算法.

    The full code is too long to list it here so giving the algorithm.

    这是上一节的补充.如果不使用它,则在安装时在 步骤中将本地瓶保存在Homebrew缓存之外的某个位置,然后将其添加到以下位置的缓存中在下面的启动时步骤中使用适当的名称.

    This is in addition to the previous section. If using without it, save local bottles somewhere outside of Homebrew cache at on installing step and add them to the cache under appropriate names at the at startup step below.

    • 安装时:

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