You will need about one minute to read this article.
For a variety of reasons, you may want to either only run commands on certain branches (i.e. only run custom alert commands on the
master branch) or exclude commands from running on certain branches (i.e. never run acceptance tests if on a branch that starts with
Below you will find scripts that you can use on your project’s setup and test commands to accomplish both scenarios.
These commands must be entered as single lines in your setup or test commands to be executed properly. Multiple line commands will get treated as separate commands instead of a single command. If you want to write a longer command as multiple lines, you should write it in a script file and then call that script instead.
If you don’t want to run a command on a specific branch use the following syntax. In this example we run your command on every branch except
if [ "$CI_BRANCH" != "gh-pages" ]; then YOUR_COMMAND; fi
If you want to run a specific command only on one branch use the following syntax. In this example we run your command only on the master branch.
if [ "$CI_BRANCH" == "master" ]; then YOUR_COMMAND; fi
Contact our support team or post on Stack Overflow using the tag
#codeship. Did you check the status page and changelog?
There are also several code examples and sample projects available for you to get started with.