Expert AWS Development
上QQ阅读APP看书,第一时间看更新

Continuous Integration – maintaining code repository

CI originates with an extreme programming development process which is one of its original twelve practices. It doesn't require you to deploy any particular tools but it is useful if you use a CI server.

CI means the developer can constantly merge their work with the master/main/trunk branch, so it will be easier for the Test team to test the latest changes with the existing changes. It will help to test code as soon as possible and provide rapid feedback, so that any issue can be identified and fixed as soon as possible. In this process, most of the work is done by automated tests which are part of the unit test framework.

The following is a pictorial representation of CI. In this process, the Dev Team, Testing Team, and Software Configuration Team work together to integrate the latest code and make it available for the next process:

Now let's look at an example.

Let's say you check out the latest working copy from the source code management system on the main branch onto your local development machine. Here, when the developer copies the code from the main branch to their own local machine, it is called a checkout and the copy on the local machine is called the working copy. Once you take the latest code from the main branch then you can update it in your working copy.

Now, you complete your task on the working copy, where you can also add or change the automated test or alter the production code.

Once you complete your development, you can start to do the automated build on your local environment. It will take the local working copy for the source code, compile it, build it, make executables, and run the automated test. If the generated and tested build contains any errors or defects, then you should fix these and repeat all the processes (such as compile, build, create executable, and run the automated test) until you get a clean build without any error or defects.

Once that is done, you can update your code base with the latest code if anyone in your team has checked in the code into the main branch, and then you can rebuild the code. You need to fix any compilation issue and then commit your code with the main branch.

We cannot say that the code is integrated successfully until the build is executed from the main branch, without any errors or issues. This build can be executed manually or automatically.

If a bad build occurs at code level, it will be identified immediately and be fixed by the team. You will never get a failed build in this CI environment, so in your team you will get many builds a day.