Have you ever heard of "Continuous Integration" but wondering what it means?
This article is for you.
Continuous Integration is one of the top technical terms that (in my humble opinion) a software engineer should know.
I'll explain in simple terms what Continuous Integration means. Hopefully, by the end of the article, you'll clearly understand why we need Continuous integration in software engineering.
WHAT IS CONTINUOUS INTEGRATION?
Let's take the following scenario:
We have three software engineers in a medium-sized company, all working and contributing towards one big project, each implementing different features. They initially work on a local branch and commit their changes at least daily.
What happens when they push their code?
Here is where Continuous Integration comes into play.
Continuous integration is a DevOps software development practice where developers regularly merge their code changes into a central repository, after which automated builds and tests are run. Amazon Web Services
Before you push your changes to the remote repository, run your tests locally. If any tests fail, address the failing tests before pushing your changes remotely.
Once all tests pass on your local machine, you're ready to push your changes remotely.
When you push your changes remotely:
- A CI Server detects any changes made by the engineers.
- If there are any changes, the CI Server looks for the most recent source code version and starts executing the build script.
- Once the build is generated, the CI Server validates all the test cases and assesses the quality of the code.
- Then, the CI Server gives you feedback via email.
- If the build fails, the CI Server informs the team. Team members read the message to understand where the issue is, fix the problem and integrate the changes back to the remote repository.
- Then we start again from step 1 until the build shows that the changes integrate successfully and tests all pass.
Continuous integration helps engineers reduce risks by giving them feedback about their code. The purpose of Continuous Integration is to help identify and fix any errors faster.
Continuous integration promotes collaboration among team members and more efficient problem-solving. It also improves the process of delivering a project.
Continuous integration requires the team to:
- Fix all problems and avoid checking in broken code.
- Ensure enough tests cover happy and unhappy paths and that they're all passing.
- Avoid checking in code when the build fails.
- Be more responsible and accountable for their code.
WHAT HAPPENS WHEN THE BUILD IS SUCCESSFUL?
If the build is successful, the code can be released to production (meaning that the changes will be released to the end-users). The practice of moving code to production is known as Continuous Delivery.
WHAT ARE THE BENEFITS OF CONTINUOUS INTEGRATION?
- It's easier to detect and address bugs.
- Reduce merge conflicts.
- You can release software more frequently.
- Better code quality.
- Rapid feedback, thanks to the CI Server.
WHY DO WE NEED CONTINUOUS INTEGRATION?
We need Continuous integration because it allows software teams to catch bugs more rapidly. Since the CI Server checks the code's quality, the software released to production will be of higher quality. Continuous integration makes it easier to release more features to the end-users.
In this article, you've learned about Continuous Integration, what it means and why it's important to know as a software engineer.
I hope you've found this article helpful.
Do you practice Continuous Integration in your workplace? Do you use any Continuous Integration tools? Let me know in the comments.
Until next time!