"Continuous integration"-One, Two, and Three

Source: Internet
Author: User
Automated testing is a prerequisite for continuous integration

Without a doubt, automated testing is a prerequisite for continuous integration.

If your project does not have a unit test or function test code, continuous integration is not that important. The significance of continuous integration can be highlighted only by the increasing number of automated tests along with the project. Continuous integration is an indicator or Vane of code health. Through continuous integration, you can discover problems as early as possible and remind team members to fix problems as early as possible to get healthier code.

Continuous integration has many practices. Based on the actual project experience, we will summarize three basic practices:

I. Start early

Continuous integration should be considered in the initial stage of the project, and a continuous integration environment should be established while building the development environment. In addition, your first check-in code file should include your build script to trigger the first build and make the build pass. After that, you need to constantly add code and improve the building process.

Some may say: "At the beginning, there were so few codes that people were working on different functional modules. There were not many conflicts. Just run the test manually, wait until you build a continuous integration environment."
In fact, once you say "wait", it is like "never ". Just like unit testing, "the code in the beginning is so simple that it doesn't have to be tested. When we think that the Code is not so simple and requires testing, we will find that unit testing is too difficult at this time, I have to rewrite a lot of code, but I still don't want to write it!" The results can be imagined.

Therefore, continuous integration is recommended when the project is the simplest.

Ii. Run as soon as possible

The main purpose of continuous integration is to get early feedback. At the beginning of the project, the code is relatively small, and the continuous integration takes less time than a few minutes. This time can be tolerated by the development team. However, as the code base increases, functions increase, and continuous integration takes longer and longer to affect the development team's productivity. You must optimize your continuous integration before that. Because when you realize this problem, it has had a negative impact. So how can continuous integration run as soon as possible?

In general, there are three ways to achieve: (1) Optimize the code, that is, optimize the existing code to make the operation faster, such as minimizing external dependencies, use a memory database instead of a file system-based database. (2) vertical expansion improves the running speed by enhancing the performance of hardware required for continuous integration [such as memory and CPU]. (3) horizontal scaling: divides the test into multiple parts and summarizes the results after running in parallel in multiple environments to save time.

3. Dedicated personnel

A dedicated person or role (CI Engineer) is required for continuous integration improvement in the project. The execution of a task can be guaranteed only when a task has a responsible person. This is particularly important in large or complex projects.

If the project is small and there are few people, you may be very familiar with the continuous integration environment. If any problem occurs, you will find the problem and solve it. However, in a large and complex project, the continuous integration environment may be more complex. What kind of configuration is there for the server with continuous integration and where the build machine is located, it is impossible for all project members to understand how to manage them. In this case, the CI engineer appears. His responsibility is to use resources as much as possible to shorten the cycle of continuous integration and make feedback faster.

Of course, this does not mean that with CI engineer, the result of continuous integration is the responsibility of him. For failures in continuous integration, all team members have the responsibility to fix the issue. Even if they cannot fix the issue, they must find the correct person to fix it.

Of course, this is not all about continuous integration, but the basic practice of continuous integration. Only by achieving these three basic practices can we effectively play the role of continuous integration.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.