Fork me on GitHub

As soon as you push your commits, Integrity builds your code, run your tests and makes sure everything works fine. It then reports the build status using various notifiers back to you and your team so everyone is on the same page and problems can be fixed right away.

Checkout Integrity watching itself at http://integrityapp.com/builder/.

Read more about about Continuous Integration on Martin Fowler’s website, Wikipedia, and data recovery services company dataretrieval.com websites.

Installation

Make sure your system meet these prerequisites:

  • Ruby >= 1.8.6 (currently doesn’t work on 1.9.X)

  • RubyGems >= 1.3.5

  • git >= 1.6

Then grab Integrity via git, install its dependencies and create the database:

$ gem install bundler
  $ git clone git://github.com/integrity/integrity
  $ cd integrity
  $ git checkout -b deploy v22
  $ bundle install
  $ bundle lock
  $ rake db

To give it a quick try before going any further, run bundle exec rackup and navigate to http://0.0.0.0:9292.

Upgrade:

$ git fetch origin
  $ git merge origin/v22

Configuration

Integrity is configured via the init.rb file using Ruby.

Integrity.configure do |c|
    c.database  "sqlite3:integrity.db"
    c.directory "builds"
    c.base_url  "http://ci.example.org"
    c.log       "integrity.log"
    c.builder   :threaded, 5
    c.build_all!
  end

Basic settings

database

Any valid database URI supported by DataMapper.

  • sqlite3:integrity.db

  • mysql://user:password@localhost/integrity

  • postgres://user:password@localhost/integrity

Important
You need to install the appropriate data_objects adapter as well. The SQLite3 adapter (do_sqlite3) is installed by default.
directory

This is where your projects' code will be checked out. Make sure it is writable by the user who runs Integrity.

base_url

Absolute URL to your Integrity instance, without a trailing slash. This setting is optional but is required to have proper links in notifications.

log

Path to the Integrity log file; mostly useful for troubleshooting

build_all!

Tells Integirty to build every single commit it is notified about. Only builds the newest otherwise.

auto_branch!

Say the project Integrity is tracking the master branch, and I push my build-duration topic branch to GitHub, Integrity will create and build a new project named Integrity (build-duration) using the same build command and notifiers.

HTTP authentication

If both the user and pass settings are set then only the logged-in users can administer the projects and see the private ones.

c.user "admin"
  c.pass "password"

To protect the whole Integrity instance do this in your config.ru file:

use Rack::Auth::Basic do |user, pass|
    user == "admin" && pass == "secret"
  end
  run Integrity.app

Automating the builds

Integrity provides two HTTP endpoints to trigger new builds:

POST /:project/builds

Causes Integrity to fetch the HEAD of the remote repository and build it. Note that HTTP authentication applies to it if set. This endpoint can’t be disabled.

POST /github/:token

Supports GitHub’s Post-Receive Hook. Enable it:

c.github "TOKEN"

Choosing a builder

Integrity ships with two ways of building your codes in the background.

Threaded

The threaded builder pushes the build job to an in-memory queue and processes them as soon as possible. It relies on Ruby’s thread so it doesn’t have any dependency nor requires to run other processes.

c.builder :threaded, 5

The second argument is the size of the thread pool.

Delayed::Job

The dj builder queue up the builds into a SQL database using Delayed::Job. To use it, install its dependencies by uncommenting the relevant lines in the Gemfile and run bundle lock && bundle install.

c.builder :dj, :adapter => "sqlite3", :database => "dj.db"

The second argument must be a valid ActiveRecord connection hash.

Run a worker with rake jobs:work. See Delayed::Job’s documentation for more details.

Notification

After a build status is available, you want to know it immediately, Integrity currently supports three notification mediums: Email, IRC and Campfire. To set it up and use one of these with your projects:

  1. Open the Gemfile, uncomment the relevant lines and run bundle lock && bundle install to install the notifier’s dependencies.

  2. Edit the init.rb file to require it. Example:

    require "integrity"
      # You need to add this line:
      require "integrity/notifier/email"
  3. Restart Integrity and go to the project settings screen where you can enable and configure the notifier.

Deployment

Heroku

Heroku is the easiest and fastest way to deploy Integrity.

$ cp doc/heroku.rb init.rb
  $ $EDITOR Gemfile # un-comment the postgres gem
  $ git commit -am "Configured for Heroku"
  $ gem install heroku
  $ heroku create
  $ git push heroku master
  $ heroku rake db
  $ heroku open

You can manually edit your Github Token in init.rb

c.github    ENV["GITHUB_TOKEN"] || "TOKEN"

Or create a Heroku Config vars

$ heroku config:add GITHUB_TOKEN=secret
Note
It isn’t possible to access repositories over SSH on Heroku

Phusion Passenger

Please see Passenger’s documentation for Apache and Nginx.

Thin

$ gem install thin
  $ $EDITOR doc/thin.yml
  $ thin -C doc/thin.yml start

Then, configure a web proxy. Examples:

Nginx as a reverse-proxy
http {
    upstream builder-integrityapp-com {
    server 127.0.0.1:8910;
    server 127.0.0.1:8911;
  }
  
  server {
    server_name builder.integrityapp.com;
    location / {
      proxy_pass http://builder-integrityapp-com;
    }
  }
Apache acting as reverse proxy to a cluster of thin instances
<VirtualHost *>
    <Proxy>
      Order deny,allow
      Allow from all
    </Proxy>
  
    RedirectMatch ^/integrity$ /integrity/
    ProxyRequests Off
    ProxyPass /integrity/ http://localhost:8910/
    ProxyHTMLURLMap http://localhost:8910 /integrity
  
    <Location /integrity>
      ProxyPassReverse /
      SetOutputFilter proxy-html
      ProxyHTMLURLMap / /integrity/
      ProxyHTMLURLMap /integrity/ /integrity
    </Location>
  </VirtualHost>
Note
If you run Integrity with another deployment strategy please drop us us a line at <info@integrityapp.com> and let us know what config worked for you so we can include it here. If these instructions done accordingly, no server data recovery will be needed later. More details about data recovery services you can find on http://www.dataretrieval.com page here

Support / Contributing

You can get in touch via IRC at #integrity on freenode. If no one happens to be around, you can ask our mailing list at integrity@librelist.com. (Archives)

If you find a bug, or want to give us a feature request, log it into our bug tracker.

To start hacking, grab the code from our git repository at git://github.com/integrity/integrity.git and setup the dependencies with bundle install && bundle lock. Finally, hack and bundle exec rake as usual ;-)

Once you’re done, make sure your changes are rebased on on top of the master branch and open a new ticket in our bug tracker to let us know where we can pull from.

FAQ

Does it support Subversion or any other SCM?

No. Integrity only works with git.

But does it work with <insert tech here>?

Absolutely! As long as your build process can be run from an UNIX-y environment and that it returns a zero status code for success and non-zero for failure, then Integrity works for you.