Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As far as I can tell, services like Travis CI and CircleCI take your project and run its test suite whenever you push a new change to your repository.

Assuming that it's also possible to either manually or automatically run such test suite locally before you commit or push your change, what's the point in using a service like this?

share|improve this question
6  
en.wikipedia.org/wiki/Continuous_integration explains the philosophy of CI pretty well, and gives you plenty of reasons why it's a good idea. I'll give you one more: you don't have to do it on your machine. It frees up your machine so that you can go on and do bigger and better things, instead of doing this. –  Robert Harvey Feb 7 at 0:22

4 Answers 4

I'm not familar with those services but CI in general is good for

It gets rid of the "Builds on my machine" excuse for comitting bad work.

If it doesn't work in CI it doesn't work.

You can then take the known working code from there and use it for things like Continuous deployment.

Some provide a history so you can tag Version 1.0, 1.1 etc so its easy to go back to them if there is some unforseen problem in the new version or you just need to release the old version.

share|improve this answer
  1. Are you sure everyone will run the tests? E.g. those commits when you're late for the plane - and that change is tiny and really-really can't break anything.
  2. Are you sure you want to run the whole testsuite on your system before every push? Some testsuites run for hours (UI automation) or execute slow tools like valgrind.
  3. Are you sure you will run the testsuite on all supported platforms? E.g. if you do a C++ application on Linux/Mac OS X/Windows it is trivial to break compilation on other platforms if you don't test there. Imagine that sometimes you may even need to test Windows7 and Windows8 separately.
  4. Build/package the whole application may take awhile by itself. CI lets you simply download the package built on the server.
share|improve this answer

One of the most common ways I've seen people break the build is when they're working on several different things at once, and they check in what they think is all the changes needed for one particular task that they have just finished.

Turns out they missed a file, or they checked in a change that was part of a separate task that isn't finished yet.

In cases like this, the tests probably do all run correctly on their machine. But the committed code no longer builds, runs, and passes all tests.

Basically, if the CI tool can get latest from source control, build it, and run the tests, you can be confident that anyone can get latest and get a working codebase.

share|improve this answer

The key idea with continuous integration is to always have a working build, that is, a build that completes successfully and passes unit tests in canonical build enviroment. This is because it's much easier to ensure that the build always works than to fix a build that accidentally got broken a while ago, esp. when no one is quite sure who broke it and when.

With continuous integration, you will immediately know if:

  • Someone has accidentally committed code without including a new source file
  • Someone accidentally used an absolute reference path
  • Someone just plain screwed up

Which means that it will get fixed immediately while the memory of the changes is still fresh.

share|improve this answer
    
The Monotone author even formulated a law, namely The Not Rocket Science Rule Of Software Engineering: "automatically maintain a repository of code that always passes all the tests". –  miku Aug 19 at 7:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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