5

I am involved with a Python/Flask based project and have to check with Travis CI builds before I submit any work. I find it cumbersome to push and then wait for the build to be done on Travis' end, check why the tests are failing and then fix, push, lather, rinse and repeat.

Can I not run Travis's setup locally? Someone has already How to run travis-ci locally but they point to different components of Travis individually. So far I have managed to install the travis-ci CLI and travis-build as an add-on.

Ideally I would want my workflow to be:

  1. commit some work
  2. have travis-ci server running locally
  3. enter a command, say travis build ~/myrepo and then it would spin off a docker container and build as if it was building on travis-ci.org website, showing me a log in the server dashboard.

Can this be done?

Community
  • 1
  • 1
Sindhu S
  • 942
  • 1
  • 10
  • 23
  • Why do you have to use Travis specifically? Can't you just run all of the tests locally before you push to Travis? Ideally, you shouldn't be pushing code that you aren't already pretty certain works. – jonrsharpe Jun 16 '16 at 11:29
  • I have to use travis because my project uses travis, some of my tests need variables plugged in the environment. do you know how I could get the above done? – Sindhu S Jun 16 '16 at 11:30
  • And you can't set those same variables in your local environment because...? Are you telling me that you can *only* run your tests in CI? Frankly, that's bonkers. You're trying to solve entirely the wrong problem. – jonrsharpe Jun 16 '16 at 11:31
  • I can set those variables locally for sure but i would like to have the above setup to like i said "mimic" travis-ci.org locally. – Sindhu S Jun 16 '16 at 11:34
  • 2
    I think you're approaching this completely backwards. You should *not* need to install a mock Travis to run all of your tests locally. If you're using Docker, you can just launch your container/composed network without needing Travis at all. – jonrsharpe Jun 16 '16 at 11:38
  • what is "composed network"? – Sindhu S Jun 16 '16 at 11:41
  • When you have multiple containers linked together: https://docs.docker.com/compose/ – jonrsharpe Jun 16 '16 at 11:42
  • could you perhaps explain your suggested solution in answer? elaborate on "you can just launch your container/composed network without needing Travis at all"? – Sindhu S Jun 16 '16 at 11:44
  • Not really, because I've no idea how your project is set up. Basically, whatever command your `.travis.yml` tells Travis to execute to run tests, try running that locally. – jonrsharpe Jun 16 '16 at 11:45
  • This question is a duplicate of https://stackoverflow.com/questions/21053657/how-to-run-travis-ci-locally Please instead continue the discussion on that question. When there are enough people that want to help make a `make travis` solution, we can discuss at that question, rather than fragmenting across multiple identical questions. – William Entriken Jun 16 '16 at 14:48

0 Answers0