Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent travis jobs after each commit?

I am developing a library on github that has travis checks attached to it. I'd like to have a WIP pull request open to discuss ideas easily. There is a lot of tests set up for the project on travis, so I'd like to not trigger the tests every time I push a commit (to prevent server for being overloaded), as the code is not expected to pass anyway.

Is there a way I could do this on github without having access to travis configuration?

like image 605
sygi Avatar asked Mar 19 '16 10:03

sygi


People also ask

How long does Travis CI take?

Are there any restrictions on build time? A build has 120 minutes to run.

Which of the following are two main parts of Travis CI job?

The first job is to build the image and the second job is going to be to run the NPM test target.


2 Answers

To skip builds on a per-commit basis you can add [ci skip] to the commit message, as described in the Docs, for example:

Before: Add blerb.
After:
Add blerb [ci skip]


To skip all non-PR builds, you can early-exit if the TRAVIS_PULL_REQUEST environnment variable is set to "false" fron your .travis.yml:

before_install:  # Earliest build step
  - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo "Not a PR, skipping" && exit; fi
like image 96
набиячлэвэли Avatar answered Sep 22 '22 03:09

набиячлэвэли


My approach is to use an alias that I defined that appends the [ci skip] to each commit message of the current branch.

wip = "!f() { git filter-branch -f --msg-filter 'sed -e "\"s/$/ \\[ci skip\\]/g\""' ${1-master}..HEAD ; }; f"
unwip = "!f() { git filter-branch -f --msg-filter 'sed -e "\"s/ \\[ci skip\\]//g\""' ${1-master}..HEAD ; }; f"
wpush = "!f() { git wip $1 && git fpush && git unwip $1 ; }; f"

So basically what I do is simply git wpush.

like image 32
se7entyse7en Avatar answered Sep 23 '22 03:09

se7entyse7en