Nodejitsu

Save time managing and deploying your node.js app. Code faster with jitsu and npm

Travis CI At Nodejitsu

About the author

Name
Location
Worldwide
nodejitsu nodejitsu

If you watch flatiron repositories on GitHub, you may have started noticing these:

These are Travis CI build status images. We started testing our code at Travis CI and we want to tell the whole world about it!

What is Travis CI?

Travis CI is a continuous integration system. Long story short: continuous integrations systems run your tests. How is it different from running them yourself?

  • clean environment - your local development environment can be pretty weird and you know it! People who use your code don't necessarily have the same settings as you have
  • easy creation of test environments
  • it actually runs the tests - continuous integration system won't say 'this change is so small that it can't mess anything up'
  • build logs are publicly visible - transparency is important, especially when it's about something other people rely on
  • it's nearly realtime - we often push code and almost instantly get notified about test results

Run the fucking tests

Why is it important for a CI to be realtime?

People make mistakes. Developers forget to npm update before npm test, keep their temporatory files and so on. You can probably write down a long list of silly mistakes you sometimes make. This can lead to pushing failing code.

Checked in failing code?

Of course, Marak doesn't do that. At least nobody can confirm it.

Few days ago, thanks to Travis, we were able to find a regression in union. It turned out to be a dependency failure, which we were able to fix in approximately 5 minutes.

So, we delivered a product in 5 minutes. Sounds like a heaven for project managers.

OK, so how does this "realtime" thing look like? Many of us spend our time on #nodejitsu IRC channel at Freenode. Thus, a natural thing was to enable IRC notifications for builds.

IRC notifications

I can definitely agree with Marak here. Point of this notifications is not only to tell you that you failed. We want people to know that their changes were good!

Versions!

We care about innovating. We care about our code being compatible with newer versions of software (node, npm and so on), but we have to care about people using older versions.

How can Travis help? Travis lets you to set up multiple test environments which target different runtime version. It's really easy to run your tests in node v0.6 and node v0.4 at the same time with just 3 lines in your .travis.yml file (detailed instructions for node.js are available here).

Build you get looks like that.

Travis is easy!

Travis is a hosted service - you don't need a sysadmin to setup a Jenkins server for you. All you need is .travis.yml file and enabled GitHub post-receive hook (which Travis can do for you!).

Besides Node.js, travis-ci.org offers first class support for several other technologies:

  • Clojure
  • Erlang
  • PHP
  • Ruby

with more languages coming in the future. It only takes a couple of minutes to add your project to travis-ci.org, give it a try and if you find it useful, consider supporting the project.

Summary

We're having a great time with Travis. It helped us find a few regressions, bugs and compatibility issues. If you're starting or if you have an open source project, you should add it to Travis. Show people that you care about your test results!