Why CI? Why CI Is Not Enough?
First of all, what is CI?
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.
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 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.
Why Do We Need CI?
Everything changes really quickly, and it’s extremely important to keep your team ahead of the curve. If you’s rather learn about the trends of where CI is headed in 2021, check out this article here.
Here are some benefits.
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.
However, There Is A Problem That Exists
All of the CI tools in the market are clunky, inefficient, may product false negatives if you ship code from a certain development suite that is on an older version than your peers, amongst many other siloes. This results in a lack of trust, and that can result in receeding performance over time.
It is also extremely important to choose a scalable tool that can handle a variety of different needs and to leverage a solution that focuses on productivity and inclusion, which encourages collaboration and improves trust, which is a requirement when pushing value to production.
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)