pyCI

a minimal CI server

View project on GitHub

Documentation

Navigation

  1. Installation
  2. Configuration
  3. Contributing

1. Installation ^

1.1 Requirements

  • Python 2.7.x
  • Python daemon library
  • Python pysqlite library
sudo apt-get install python2.7 python-daemon python-pysqlite2

1.2 pyCI service

  • Download the latest version of pyCI.
  • extract the archive and change to it's directory
  • run sudo python setup.py install
  • edit the /etc/pycirc file and add your projects (for more information visit the configuration section)
  • start the service with sudo service pyCI start

The service will automatically start when rebooting your machine. The assets for the web interface are copied to /var/www/pyci and owned by the user and group www-data.

1.3 Web Interface (Nginx + fcgiwrap)

Here is a default configuration for the web interface with nginx and fcgiwrap. Don't forget to change the SERVER_NAME to your own.
server {
    listen      80;
    server_name SERVER_NAME;

    location ~* ^.+\.(css|ico|js)$ {
        root    /var/www/pyci;
        expires 30d;
    }

    location / {
        fastcgi_pass  unix:/var/run/fcgiwrap.socket;
        fastcgi_param SCRIPT_FILENAME /usr/local/bin/pyci.cgi;
        fastcgi_param PATH_INFO $uri;
        fastcgi_param QUERY_STRING $args;
    }
}

2. Configuration ^

To change the configuration update the /etc/pycirc file. An example will be added after the first installation.

2.1 Global configuration options

The global configuration sections starts with the keyword start_config.

Option Description
config.build_success A command that runs if all builds are successful. The command will be executed after a complete build run, also if there where no new builds.
You can use any command available on your commandline.
config.build_failed A command that runs if one ore more builds have failed. The command will be executed after a complete build run, also if there where no new builds.
You can use any command available on your commandline.
config.vcs_error A command that runs if one ore more builds can't downloaded from the Repository or if no repositories listed in the configuration file. The command will be executed after a complete build run, also if there where no new builds.
You can use any command available on your commandline.

2.2 Repository configuration options

A new repository section starts with the keyword new_repo.

Option Description
repo.url The URL for to the remote Git repository. You must be able to clone the repository from your server.
repo.branch The Branch of your Git repository you want to checkout. If no branch is given the default the branch "master" is used as default branch.
repo.name A unique name for this repository. If you change this name, a new entry will be generated for this repository and you are no longer able to change the old one. (This will be changed in a future versions that you can edit the name and delete old repositories.)
repo.step# This is one step of the command chain. # has to replaced with an integer number. All the steps can will be executed in the order of their number. If one step has an exit code other than 0 or writes to stderr the step will fail. (This will be changed in a future version so you can configure the parameters for a step to fail or pass.)

2.3 Example configuration file.

start_config
config.build_success=delcom-usbled -g
config.build_failed=delcom-usbled -r
config.vcs_error=delcom-usbled -y

new_repo
repo.url=https://github.com/tbraun89/pyCI.git
repo.branch=master
repo.name=My pyCI - master Branch
repo.step0=cd tests; python suite.py

3. Contributing ^

  1. Fork it (https://github.com/tbraun89/pyCI/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add your feature and don't forget the tests
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a Pull Request

To run the test you just have to switch to the tests folder and run the suite.py file.

cd tests
python suite.py

If you find a bug and can't fix it, you can create an new Issue in the Bug Tracker. Pleas check if the bug ticket already exists or is marked as fixed for a future version.