Continuous Integration, and Continuous Deployment for Ruby/Rails

Scrutinizer makes testing and analyzing Rails code simple. Before each build, Scrutinizer infers your build configuration and test commands. This works very well most of the time. If you have a specific set-up that does not follow the standard practices, you can fine tune your configuration by placing a .scrutinizer.yml file in your project's root folder.

Ruby Version

We use rbenv to make a range of Ruby versions available in our build environment. By default, we either use 1.9.3-p448 or 1.8.7-p358 for running your build, whatever seems best.

If you would like to force a specific Ruby version, you can do so in your .scrutinizer.yml:

build:
    environment:
        ruby: 'jruby-1.7.9'

You can learn more about how the configuration file works, and the available Ruby versions and checks in our build environment documentation.

Dependencies

Scrutinizer automatically installs your dependencies if you have placed a Gemfile in your project using bundle install. If you need to run other commands, you can add them in your .scrutinizer.yml:

build:
    dependencies:
        before:
            - bundle exec rake assets:precompile

Project Setup/Database

We will take care of initializing the database using the standard rake tasks for setting up and migrating your database. We provide several databases and queues including MySQL, PostgreSQL, and RabbitMQ pre-installed, if you like you can also install custom software in your build environment.

Testing

Scrutinizer will automatically try to infer your test commands. We support running tests via Test::Unit, MiniTest, cucumber, spinach, rspec, jasmine, konacha and qunit.

You can override the default test commands in your .scrutinizer.yml file:

build:
    tests:
        override:
            - ./run-tests.sh

Code Coverage

Scrutinizer can automatically process the code coverage of your test runs - whether you only have a single run or run your tests in parallel. When you have set-up the scrutinizer-ocular gem, you can adjust your test command to generate code coverage:

build:
    tests:
        override:
            -
                command: bundle exec rake test
                environment:
                    'SCRUTINIZER_CC_FILE': 'my-coverage'
                coverage:
                    file: 'my-coverage'
                    format: 'rb-cc'

If you have multiple commands that generate code coverage data, we will automatically take care of merging it.

Deployment

Scrutinizer provides first-class support for deployment. Once all your tests have passed, it will automatically trigger deployment of your code. You can define deploy commands in your .scrutinizer.yml file:

build:
    deployment:
        -
            branch: master          # you can use either the full branch name,
            branch: feature_*       # an asterisc for e.g. any feature branches
            branch: /feature_.*/    # or the same as a regular expression
            commands:
                - cap deploy

Automated Reviews

Scrutinizer supports a wide-range of automated checks for Ruby code including code rating, code metrics, duplicate code detection, and many more. A basic configuration which enables code rating and duplicate code detection looks like this:

checks:
    ruby: true

Learn more about configuring automated code reviews for Ruby.