If you don’t have CI Testing, Unit Testing, and 100% code coverage, your product is at risk.
The last few months we have been focusing on streamlining our development workflow. When a new hire comes on board we want him/her to submit their first pull request within 10 minutes. While most engineers won’t actually commit code within 10 minutes, we favor this approach for 2 reasons:
To accomplish the first goal, we needed to minimize the number of steps in the setup process. Moreover we had to ensure instructions for the remaining steps were clear and concise. We also wanted to abstract all the manual work by incorporating as much of the setup process as we could into our code base.
The second goal was much harder to accomplish. Our biggest fear about bringing new people on board was that they would commit code that would somehow impact the codebase unintentionally.
We needed to implement a process that would prevent unintentional errors from reaching production, increase the understanding of the current code, and give our engineers 100% confidence that the new code is error free.
Here is what it takes to get Lob Dev Environment up and running on a Mac:
That’s it….we are ready to commit!
Now for the harder part. Here is our dev workflow:
Using Gulp.js we are able to force syntax checking during the development workflow. Every time a developer saves, the codebase is linted (using jshint) to ensure syntactic consistency across the organization. If there are errors, we prevent the developer from starting the development server. This forces them to fix the error right away as they cannot continue developing without re-starting the server.
Once the developer has code that they think is production ready, they can run "gulp test" locally. Our Gulp test uses Mocha and Istanbul to ensure 100% of the tests pass and that we have 100% code coverage.
Given that the tests pass locally and there is 100% code coverage, developers can now commit their code to Github. On commit, we immediately trigger a build on Circle CI. We hooked up our CI results to our main Engineering Hipchat Room, so not only will they get a green or red light once the test completes, it will have their name right next to it. This enforces people to double check their code locally before they commit, as no one wants to be the person that has a bunch of "FAILED BUILDS" next to their name.
We are building out processes such as these to further boost our engineering productivity, ship code faster, and continue developing new product features in an agile fashion. If you have any comments on our process or ways to improve it, let us know!