Travis CI:构建矩阵项中的分支过滤器
Travis CI: branch filters in build matrix items
我们想知道是否有任何方法可以为 Travis 矩阵项添加过滤器。在我们的特定情况下,我们希望 运行 仅在特定分支上执行某些作业。
以下示例是配置此方案的理想方式,但它似乎不起作用:
matrix:
include:
- env: BUILD_TYPE=release
branches:
only:
- master
- env: BUILD_TYPE=ci
branches:
only:
- develop
作为解决方法,我们可以通过检查适当的环境变量 (TRAVIS_BRANCH
) 立即退出构建脚本,但这远非理想,因为启动从机和克隆 repo 需要相当长的时间时间。
您现在可以使用测试版功能实现这一目标 Conditional Build Stages
jobs:
include:
- stage: release
if: branch = master
env: BUILD_TYPE=release
- stage: ci
if: branch = develop
env: BUILD_TYPE=ci
我们想知道是否有任何方法可以为 Travis 矩阵项添加过滤器。在我们的特定情况下,我们希望 运行 仅在特定分支上执行某些作业。
以下示例是配置此方案的理想方式,但它似乎不起作用:
matrix:
include:
- env: BUILD_TYPE=release
branches:
only:
- master
- env: BUILD_TYPE=ci
branches:
only:
- develop
作为解决方法,我们可以通过检查适当的环境变量 (TRAVIS_BRANCH
) 立即退出构建脚本,但这远非理想,因为启动从机和克隆 repo 需要相当长的时间时间。
您现在可以使用测试版功能实现这一目标 Conditional Build Stages
jobs:
include:
- stage: release
if: branch = master
env: BUILD_TYPE=release
- stage: ci
if: branch = develop
env: BUILD_TYPE=ci