What Is Continuous Integration and How to Benefit From It?

Your product ideas may be the greatest of all time, but without delivering well and delivering often, it may be extremely hard to keep up with the competition. In this article, we’ll show you how continuous integration and delivery can help you do just that.

What you’ll learn about in this article:

  • Benefits of CI/CD
  • How to maximize the value of CI/CD
  • Challenges
  • How to get started

Continuous integration, continuous delivery, and continuous deployment

Continuous integration

Continuous integration (CI) is the software development practice of regularly integrating code changes into a shared code repository. Typically, this would happen at least once or then several times a day (depending on the number of code commits) and this practice encourages committing small changes more often over committing large changes infrequently. Each commit triggers a build during which tests are run that help to identify if anything was broken by the changes.

Continuous delivery (CD) and continuous deployment

Continuous delivery is all about the ability to continuously deliver integrated code, be it bug fixes or new features, to production. It means that your “green builds” are ready to go in one click, should you wish to release them.

Continuous deployment goes one step further as it allows you to automatically deploy live every main branch change that passes the CI. However, you might have business reasons for not doing so automatically or you might need to do testing that can’t be automated.

How to get started with continuous integration and delivery?

It’s really easy to get you up and running with the right continuous integration service. Here’s a really short list of basics you need to get started with CI.

  • Implement version control of your choice (Git, Bitbucket, SVN, etc).
  • Write tests for the critical components in your code base (and treat your tests as production code).
  • Get a suitable continuous integration and delivery service that will enable you to run those precious tests on every push to the repository and also deploy your builds where you need them.

If you are ready to set up continuous integration server for your Android, iOS, Cordova, React Native or Ionic projects, check out our step-by-step guide how to set up mobile projects in Nevercode

Benefits of continuous integration and delivery (CI/CD)

Let’s dig into what implementing continuous integration to your everyday software development process can bring to the table. Realizing these benefits means reducing risks for each build and clearing the way to get your valuable features out to customers faster.

Overview of continuous integration and delivery process

 

Fast feedback loop. In software development, what you don’t know really can hurt you. If there’s anything that really slows you down when developing software, it’s the lack of feedback on the quality and impact of the changes you made. You might think you move fast if you quickly commit code and move on to another task without running any tests or sanity checks. The reality will hit you later when you’re trying to figure out which change and from when (and by whom…) broke something. Continuous integration tools — when properly used — will remove much of this headache by providing you with quick answers to the question “did I break something?” for each commit.

Increase transparency and visibility. When your CI/CD pipeline is set up, your entire team will know what’s going on with the builds as well as get the latest results of tests, which means they can raise issues and plan their work in context. You can see which changes tend to break builds more often.

Avoid “integration hell”. If you think of software as a set of Lego pieces, each of which is crafted by an individual developer separately, it becomes clear that making different pieces go “click!” without any effort and friction is what helps the team make progress every day. If a specific piece is fine on its own in terms of implemented code, you will still need to make sure it plays nice with everything else. Continuous integration supports connecting the pieces of your software every day.

Detect and fix issues early. The thing with bugs in software is that they hide other bugs that hide other bugs that… yes, you guessed it, hide more bugs. The more bugs pile up, the harder it is to test and find them, resulting in nasty last minute surprises (especially on a Friday night). If various kinds of useful automated tests are run in your continuous integration pipeline, you’ll be able to know what to fix as soon as a test fails. Not all of the testing can be automated and it takes time to automate what can be automated, but doing so helps you develop software in a sustainable way and keep the technical debt at a minimum.

Improve quality and testability. The easier it is to test something, the easier it is to determine its quality. Testability has multiple dimensions. On the inside, testability can be characterized by how controllable, observable, unbuggy, and decomposable your product is. Simply put, if your code is written in a way that doesn’t accommodate writing tests for it, you will have a hard time making it unbuggy. On the outside, testability is affected by how easily new builds are available, what kind of tools you have, and how much control you have over your test environments. Continuous integration and delivery drive both since you will need to write tests and run them, and also deliver builds frequently and reliably.

How to maximize the value of continuous integration and delivery (CI/CD)

In the context of continuous integration and delivery, appropriate automation of tests and running them for every build is essential. They are meant to inform you of threats to quality, and quality may precisely be what sets you apart from your competitors.

Writing tests is often skipped, or then broken tests are abandoned and never rewritten because it seems like it just takes too much time to do it.  In reality, spending time to write a few useful unit tests will pay off fast and save you the effort of debugging issues that could have been detected by unit tests. You could spend the debugging time on writing code for new features, just saying.

A situation that continuous integration and delivery can help to keep under control

Unit tests

Think strategically of the quality of your product to identify what kind of testing is the most valuable. Write unit tests to check your implementation of functions and methods.

Integration tests

Write integration tests to ensure that different components work together. Set up acceptance tests to also validate important business requirements.

UI Tests

Write UI tests to cover important user scenarios. Conduct exploratory testing to discover issues your automation wouldn’t find.

CI/CD tools can also support you by offering code coverage analysis to find untested code, overview of test results over time to see trends, etc. These are powerful functions that increase transparency and visibility which, in turn, help to make better decisions during the development process.

If you really want to build high quality software, there are simple steps to eliminate bugs faster and improve the quality of your software

How to choose the CI/CD tool for your needs

There are several continuous integration and delivery services that you can choose from depending on your needs. A few things to keep in mind when starting to research your choices:

  • Open source vs proprietary: depending on your context, open source tools may be off the table due to client requirements. If open source tools fit your budget and context better, there are options available, such as Jenkins. Before jumping to conclusions, get acquainted with the downside of open source CI servers.
  • Self-hosted or in the cloud: if you need to host the CI/CD service yourself and have the energy and time to set up, configure, and maintain it, you might go with something like Jenkins or CruiseControl. However, if you’d like to cross build infrastructure maintenance off your to-do list for good, you should look at a software-as-a-service type of solutions hosted in the cloud.
  • Ease of setup: making the adoption of CI/CD frictionless is perhaps key to getting everyone on board. A huge learning curve and effort for setting up a CI/CD pipeline may be hard to justify when you’re already pinched for time.
  • Build status: since adopting CI/CD is about transparency and visibility, it’s also important to make it visible and transparent your way. It might look like a nice-to-have thingy, but getting notifications in your Slack channel, via email or in other channels may improve the flow of information considerably.

To make a conscious decision and hit the jackpot the first time check out comprehensive list of continuous integration tools by Stackify.

Challenges of continuous integration

There are always two sides to the story. When implementing continuous integration you might face various challenges, some of which we’ve highlighted for you below.

Ostrich SyndromeFast feedback about broken builds is great… if you also have the discipline to address the issues then and there. It can easily look like dealing with the issues slows you down from hitting those looming deadlines. Why not cut a corner this time because, you know, the customer really needs this feature and we need to deploy… It takes whole team commitment and understanding of the value of addressing issues immediately to improve the quality and sustainability of your development efforts. Each issue shows you there’s something to improve and learn. If allowing the technical debt to grow is your short-term strategy, then make it a conscious decision. But don’t bury your head in the sand by ignoring issues indicated by your CI/CD pipeline.

Forgetting the peopleIt might seem that CI is about tools and tools only. While it’s true that tools are essential in enabling you to integrate and deliver continuously, adopting CI as a practice starts with changing one’s mind(set). It takes different people a different amount of time and effort to change their habits and thought patterns, which means that time and patience are needed to guide them through the change. In addition, larger organizational and process-related challenges may arise when different teams/divisions need to figure out how to work in a new way.

Arming your developers with the best tools out there is definitely key to a quality product. If you are curious about other ultimate ways to supercharge your software developers’ productivity, look no more.

Slower buildsIf you dutifully add tests as your product grows, build times can increase over time. It can creep up on you, so monitor your build times to identify when it makes sense to use test parallelization.

Conclusion

Building software is incredibly complex and getting it right is difficult. Use the right tools to keep you on track and support your development process in a meaningful way. Keep in mind these principles of running a successful CI/CD pipeline (which may also help to keep you sane):

  • Integrate your changes every day
  • Write the tests to create a safety net
  • Run your tests to know what to fix
  • Fix or delete the tests you no longer need
  • Keep builds green
  • Involve the team(s)

1 Comment

  1. TKSL says: October 25, 2018

    The article states that SVN is supported – is that true? I haven’t been able to get Nevercode working with SVN in my trial and support suggested it wasn’t possible.

Leave a Reply

Your email address will not be published. Required fields are marked *