build - Monorepo、Travis 和 Matrix 构建 : How do I build a specific path only when it changes?

标签 build continuous-integration travis-ci

我有一个包含多个 (java/gradle) 项目的单一仓库:

project-a/
project-b/
project-c/

我想创建一个矩阵构建配置,每个项目一个构建。而且我只想在项目发生变化的情况下构建该项目。

这可能吗?

我可以很容易地创建一个脚本来检查一个文件夹是否受到了使用 $TRAVIS_COMMIT_RANGE 的影响。但是我将如何在 .travis.yml 中使用它?

编辑

Travis 中存在 adding support for include/exclude paths for when to trigger builds 的问题.有了矩阵支持,这将解决我的问题。

最佳答案

您基本上以一种或另一种形式询问条件构建。不幸的是 the documentation about conditional builds声明

Jobs created via matrix expansion currently cannot have conditions.

...即使它支持它,我也没有看到任何简单的方法来检查 the list of supported conditions 中的提交路径.

尽管如此,可以使用他们的 API 来实现该过程。您可以创建一个旨在仅运行脚本的构建配置,并检查现在需要构建哪个子项目。这个元构建脚本可以 trigger a travis build via the API .在该文档页面上,您可以找到如何从矩阵触发特定作业的示例。

关于build - Monorepo、Travis 和 Matrix 构建 : How do I build a specific path only when it changes?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39596177/

相关文章:

python - 如果测试没有足够的 python 覆盖率,如何让 travis 失败

Eclipse:清理、构建和发布之间的区别

plugins - jenkins 插件显示当天的构建摘要

android - Android Build在 ':app:dexDebug'失败,出现异常(库和应用程序项目)

iphone - 如何在 iPhone 构建阶段将文件复制到库或文档目录?

wpf - 如何在 appxmanifest 中自动提供版本?

github - 特拉维斯 : We couldn't find the repository

git - 使用 svn repo 自动运行 Travis-ci?

npm - 在 Travis 中跳过 npm postinstall 脚本

github - 如何将应用程序限制为 AWS Opsworks 中的一种类型的层?