Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis-ci: Watch and build a single branch from a Git remote repository

I am actually envountering some issues with Travis-CI. Let's say that I have a repository on Github, with multiple branches. I just need to validate and build the master branch, and ignore any other branches. Looking at Travis docs, it seems I have to push a single .travis.yml file in every single branch of my repository. But should all these yml files have the same contents ? In other words, do I have to have this at the top of each single travis.yml file in every branches:

In every single yml file

branches:
  only:
    - master

In my yml file, I wish to run a script that runs specs tests, in the master branch, that validates the build with travis. Those specification tests are written in files that only exist in the master branch, not the others, as I don't need them there. So, I guess I'll also have to skip the script part in the yml file pushed in every branch different than the master ? As follows:

#YAML file (master branch)
branches:
  only:
    - master

# run the script
script: "tsc -f specs/*"

In some other branch:

#YAML file (any other branch)
branches:
  only:
    - master

Thanks reading.

like image 262
Roland Y. Avatar asked Feb 07 '13 08:02

Roland Y.


1 Answers

Yes, you currently have to specify the build-branches in the .travis.yml for every branch.

No, the script line does not have to be included in every branch's file.

Edit: You might also be interested in observing this feature request for travis-ci.

Update: Since March 2014, you can disable building for branches/commits without a .travis.yml file in the repository settings on travis-ci.org. The option is (currently) called "Build only commits with .travis.yml file", see also this blog post

like image 77
Nevik Rehnel Avatar answered Oct 22 '22 23:10

Nevik Rehnel