Omg! Pull Request!

Omg! Pull Request! is a daemon designed to easily run automated tests for a project that is hosted on GitHub on the submission of a pull request. On completion of the tests the daemon will make a comment on the pull request on the status of the test suite.

Goals

  • Allow simple configuration for a standard rails project
  • Support flexibilty and extensibility to work in non ruby/rails projects
  • Reduce test failures caused by merging in code with broken tests

Non Goals

  • Work with non-github environments

Integrations

The project integrates with a number of third party services to maximize usefulness / coolness.

Prowl

Prowl integration allows you to setup a phone to be alerted when the test suite completes. You will be alerted if you are the author, or have commited in the pull request.

Lolcommits

On running the test suite an animated gif can be generated of the lolcommits that were generated by the pull request. This feature was added for the lulz.

Plugin Support

Omg Pull Request supports integration with third party plugins, through an event driven architecture. You can subscribe to the following events: initialize, closed, merged, run, execute.

The following methods allow you to subscribe to events.

OmgPullRequest::Plugin.subscribe(method, &block)
OmgPullRequest::Plugin.initialize(&block)

To see an example of a plugin here.

Installation

  • In a rails project, add omg_pull_request to the Gemfile.
  • Make an omg_pull_request directory in the project's test directory.
  • Make an .omgprrc directory in the project's root directory.
  • Add a database.yml file in the .omgprrc dir. This will drop databases, so it is suggested this points to different databases than the main config/database.yml file
  • Create a github user to run the tests as. This user will need to have access to the repo the test is run on. It can be your developer account, or a new account specifically for this.
  • Add a config.yml file in the .omgprrc dir. It follows this template:
repo_owner: kenmazaika
repo: pictures
locale: en
runner: Rails 

github_credentials:
  login: github_user 
  password: github_password

storage:
  provider: Aws
  access_token: s3_token
  secret_token: s3_secret 
  bucket: s3_bucket

prowl:
  application: wherebot
  keys:
    kenmazaika: key
    [email protected]: key

This is a sample config, with sensitive data scrubbed for running tests on the repo: https://github.com/kenmazaika/pictures. One important note is for the prowl integration it should contain a key for both the github user_name and the email address that can be pulled from git.

  • On a server someplace clone the repo. This cloned repo will be managed by the daemon, and the tests will run on it from now on.
  • In a screen session run omg_pull_request.
  • Enjoy.

Configuration

A detailed specification of the available configuration options can be found in the markdown file located docs/configuration.md.

Example

You can see an example of a successful pull request that has been omg_pull_requestified here: https://github.com/where/omg_pull_request/pull/1. And an example of a failed pull request that has been omg_pull_requestified here: https://github.com/where/omg_pull_request/pull/2.

Future Features

Got an idea for a future feature? Know of a cool service that you think omg_pull_request integration with would be nice? Open up a github issue.

Current Thoughts

  • Twilio Integration would be a cool feature. Getting a text message when tests pass would be nice.
  • Monitoring the pull requests and sending the author a notification when the pull request has been closed (either merged, or just closed) would be useful.

Running Integration Tests

Integration Tests call the github api, and verify the full flow works. Before you run, you'll need to authenticate with a github profile that the tests can run on. To do this run rake test:setup.

Contributors

  • Ken Mazaika
  • Jean-Charles Sisk
  • Master William Desmarais
  • Ian Asaff
  • Jack Thorne