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
We use rbenv to make a range of Ruby versions available in our build environment.
By default, we either use
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 configuration:
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.
Scrutinizer automatically installs your dependencies if you have placed a Gemfile in your project using
If you need to run other commands, you can add them in your configuration:
build: nodes: my-tests: dependencies: before: - bundle exec rake assets:precompile
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.
Scrutinizer will automatically try to infer your test commands. We support running tests via
You can override the default test commands in your configuration file:
build: nodes: my-tests: tests: override: - ./run-tests.sh
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: nodes: tests-with-coverage: 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.
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 configuration file:
build: nodes: deploy: requires: - branch: master # you can use either the full branch name, - branch: /feature_.*/ # or a regular rexpression - node: my-tests # only run if my-tests node has succeeded commands: - cap deploy
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 build: nodes: analysis: tests: override: - ruby-scrutinizer-run
Learn more about configuring automated code reviews for Ruby.