Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger a fail in Travis CI?

Tags:

bash

travis-ci

One of my test is a simple bash command with an if condition. I want Travis CI to consider a build as failed if the condition is positive.

I try to do it this way (a part of the .travis.yml file):

# ...

script:
    - npm run build
    - if [[ `git status --porcelain` ]]; then >&2 echo "Fail"; fi

# ...

But when the condition is positive, the message is just printed and the build is considered as successful.

What should I do to make a build failed when the condition is positive?

like image 376
Finesse Avatar asked Dec 01 '25 23:12

Finesse


1 Answers

Just add exit 1; after the echo. More info.

like image 54
l0b0 Avatar answered Dec 03 '25 14:12

l0b0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!