A Continuous Integration System

来源:互联网 发布:淘宝店铺实战宝典pdf 编辑:程序博客网 时间:2024/05/19 15:18

What is a Continuous Integration System

CI Systems are dedicated systems used to test new code,it is the responsibility of the continuous integration system to verify that this commit will not break any tests.So the system must be able to fetch the new changes,run the tests and report the results,also should be failure resistant.

The system also should handle load well,so we can get test results in a reasonable amount of time.We can achieve this by distributing and parallelizing the testing effort.

Project Limitations and Notes

this project uses Git as a repository of the codes that need to be tested.

CI systems need not run on a fixed,regular schedule,you can also have them run every few commits or per-commit.It will run tests against the most recent commit made.

CI system also have a reporter aspect,where the test runner reports its results to a component that makes them available for people to see,usually a webpage.

Introduction

The basic structure of a CI system consists of three parts:an observer,a test job dispatcher and a test runner.

then observer watches the repository.When it notices a commit has been made,if notifies the job dispatcher.The job dispatcher then finds a test runner and gives it the commit number to test.

Also you can add the load handling,fault-tolerant system and some other modules.

in this project each of the components has its own process and let us run multiple instances of each process.This is useful if you want to run many tests at the same time.The components communicate via sockets,which will let us run each process on a separate machine.A unique host/port address is assigned to each component and each process communicate with others through the messages at the assigned addresses.

Files in the Project

the repository observer: repo_observer.py
the job dispatcher:dispatcher.py
the test runner:test_runner.py
the code used to transmit information:helpers.py
this three components communicate with each other using the sockets

Initial Setup

  • Firstly we should setup a code repository that will be used.I will use my PI as a code server:
cd ~mkdir test_repocd test_repogit init

This is where the developers check in their code,so our CI should pull this repository and check for commits,then run tests.
The code observer works by checking commits and we need at least one commit in the master repository:

cd ~/test_repomkdir testsgit add .git commit -m "add tests directory"

–To Be Continued

原创粉丝点击