For more, please visit my GitHub repo: github.com/kingcos/Per…

Preface

A software engineering project usually has many repetitive and fixed steps from authoring, to testing, to final delivery to the user. Although as developers, our core task is to write code, these other steps should not be ignored. Continuous Integration can help developers complete these trivial tasks and improve the development efficiency and quality of the team.

This article will focus on what continuous integration is and its benefits. Of course, you may have noticed the “(A)” after the title. It is true that continuous integration cannot be summarized in one article. The author hopes to summarize the content related to continuous integration used by the current team as much as possible, in order to let everyone think about how to make continuous integration better serve our development. Of course, limited to the author’s ability, the text inevitably omissions, but also hope readers can criticize and point out.

What

Continuous Integration (CI) is translated from Continuous Integration (CI). Wikipedia also has a particularly detailed and professional introduction to CI. In short, when a developer submits code through a version control system (such as Git), the CI system automatically performs the build, analysis, test, and other services for the developer. The current services pass, and the CI system can deploy the product directly to production, and then proceed to the next cycle. Each of these steps is automatically triggered, executed, and the results are automatically reported back to the developer. As you can see below, CI focuses on C — persistence.

Why & Why not

So why CI? What are the benefits of developing first, testing later, launching later? During the time that the team used CI, the following two main benefits emerged:

  1. Catch errors in time. CI cannot eliminate errors, but it will find errors as early as possible, so it will save more time to correct errors. Developers are most familiar with the code when they submit it to the repository. If errors or inaccuracies are corrected as quickly as possible, the developer will notice and correct the errors quickly, avoiding problems caused by time or changes made to the code by others on the team and improving development efficiency.
  2. Automation. All CI platforms on the market give developers a high degree of freedom to execute scripts or commands. Therefore, many automated operations can be programmed to be performed automatically, saving the developer time.

If these two obvious benefits aren’t enough, see EKATERINA NOVOSELTSEVA’s article in the end Reference. Is there any difficulty with CI?

  1. Across technology stacks. CI is not specific to the front end or back end, and often varies from platform to platform in terms of configuration methods, languages used, degrees of freedom, and so on. CI is also related to the development of Docker to a certain extent, so some teams may be discouraged from crossing technology stacks. However, the good news is that DevOps (Development & Operations) is also emerging in China.
  2. Cross-platform. The platforms referred to here are code hosting platforms, CI platforms, and deployment platforms. At the beginning of the company, it may not be easy to consider the future growth, so adding CI to the existing platform may require cross-platform collaboration. For “black box” platforms, integration is sometimes difficult. However, the two major Git platforms GitHub and GitLab support CI platforms, which are also easy for developers to use.

If the latter two questions don’t deter you, try CI

How

CI is not tied to a particular technology stack; it belongs to a programming paradigm. However, when it comes to practice, this requires customization with a combination of different tools and businesses.

Jenkins

Jenkins is a Continuous integration tool developed in Java and open source. Many iOS teams use Jenkins & Fastlane internally to automate packaging. Because Jenkins is open source, it can be easily deployed on its own server, and there are also many plug-ins to assist with different technology stacks and functional requirements. Swift also officially uses Jenkins as its CI.

GitHub with Travis CI

GitHub, as everyone knows, is the largest code hosting platform in the world, but GitHub itself does not integrate CI. However, there are many CI platforms that customize GitHub’s CI environment, and Travis CI is one of the most used. Seeing a.travis. Yml file in the GitHub repository means that the repository integrates Travis CI. For open source projects, this option eliminates the need for the developer to configure the server separately to run CI, although it may be slower. I tried Travis CI when writing a personal command line tool, and it was very easy to label CI status and code coverage Budge in project documents.

GitLab with CI

Compared to the above platforms, GitLab really combines code hosting with CI, and Auto DevOps was added in the latest Release, which seems to be a more advanced CI. GitLab EE is currently used in the team, and GitLab will be the main focus in the follow-up, and GitLab Runner will be discussed to standardize the development process.

Reference

  • Continuous integration – Wikipedia
  • Top benefits of continuous integration – EKATERINA NOVOSELTSEVA
  • Jenkins
  • Travis CI
  • GitLab