如何在合并到master时运行Integration



我有Travis CI,它正按预期用于Go应用程序

language: go
go:
- "1.10.x"
script:
- go get -v -t -d ./...
- go test -v ./...

此CI大约需要一个60-80 sec才能运行。

CI在两种情况下触发

  1. 提交到新分支
  2. 合并到master

现在我有了一个名为integration_test.go的新文件,它正在运行集成测试,大约需要10分钟(部署等(我只想在合并到主测试时运行这个测试(因为它更重(,而不是在提交到分支时运行,Travis,如何做到这一点?

我试过

on:
branch: master
condition: `go test -v integration_test.go`

您可能在这里寻找的是一个"有条件的工作"。使用此处的示例:https://docs.travis-ci.com/user/build-stages/matrix-expansion/

尝试:

language: go
go:
- "1.10.x"
script:
- go get -v -t -d ./...
- go test -v ./...
jobs:
include:
- stage: integration
if: branch = master
script: go test -v integration_test.go

最新更新