I'm trying to write a .travis.yml file to test my ethereum contract.

In order to test it, I need to start up an instance of the ganache-cli ethereum client by calling

ganache-cli -p 7545

and then run some truffle commands:

truffle compile
truffle migrate 

However, if I put the ganache-cli command in the script section of my .travis.yml file like so:

- ganache-cli -p 7545
- truffle migrate 
- truffle test

My truffle commands are never called because the entire terminal instance is taken over by the instance of the ganache-cli client that is started up.

I've tried putting the ganache-cli call in before-scripts like so:

- ganache-cli -p 7545
- truffle compile
- truffle migrate --network development
- truffle test

Using the above code, the ethereum client is never started. Does anyone have any idea how to setup my .travis.yml file to both start the ganache-cli client as well as allow me to call my truffle migrate/test commands?


You can use the following script:

- ganache-cli -p 7545 > /dev/null &
- sleep 5
- truffle migrate 
- truffle test
  • First script didn't work, second one worked though! Thanks.
    – willhay
    Mar 13 '18 at 20:45
  • I'll update the answer, and remove first one.
    – Ayushya
    Mar 13 '18 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.