Travis-ci build runs forever after the app starts successfully

it just goes forever here is my yaml:

python:
  - "3.7"

install:
  - pip3 install -r requirements.txt
  - pip3 install pytest

before_script:
  - chmod +x deploy.sh
  - chmod +x changelog.sh



branches:
  only:
    - travis-test

script:
  - python3 -m tg_companion

after_success:
  ./deploy.sh

im not sure what im doing wrong…

Hard to know what exactly is causing this without the log, but I suggest wrapping the start of your app in a script which kills it after a certain amount of time.

In travis.yml, add in your script: hook a file called timeout.sh (or whatever you want it to be named):

script:
  - timeout.sh

Then create a timeout.sh script:

#!/bin/bash

python3 -m tg_companion &

bg_pid=$!

sleep 120

kill $bg_pid

exit 0

Alternatively, this would be possible, in which, say you have your module notice when it is being ran in test mode, and kill itself after a timeout - possibly a command-line flag, or looking at the environment for e.g. TRAVIS=true or CI=true.

Montana Mendy
Travis CI Staff
Happy Building!