A continuous Integration process with Ruby On Rails



Ruby on Rails developer @

Technical Lead @


Jan Varljen


Part 1: Pinpoint problems
- in-house development (4 years)
- large codebase
- no tests whatsoever
- three environments
- development
- staging
- production
Part 1: Requirements
- iterative development model
- Develop something, try it out on real users
- daily deploys
- A couple of times a day
- no deployment model
- Who deployed what? Where?
- data migrations
- We often change the data structure
What is Continous Integration (CI)?
software development practice where members of a team integrate their work as frequently as possible to reduce integration problems and code conflicts
- You need tests
- You need to have a workflow
- You need to automate the workflow
What do you need?
Part 2: Write tests
- model specs
- controller specs
- javascript specs
- feature specs
- RSpec
- FactoryGirl
- Shoulda gem
- Jasmine-rails
- Capybara
Types of tests we write
Tools we use
Problem
~ 1900 tests
~ 8 min on MacBookAir
Tests are slow
Developers don't run them
Part 3: Workflow
- similar to "github flow"
- http://scottchacon.com/2011/08/31/github-flow.html
- feature branching
- master always "deployable" - don't pollute master with buggy code
- first deploy big changes to staging environment
- use automated data migrations always
- centralised communication system
Part 4: Automate the workflow
- set up and maintain your own CI server
- or go with a hosted solution



Why Semaphore?
- easy configuration (Ruby, PHP, Javascript...)
- automatic trigger on every code commit
- nice GUI
- easy integrations
- supports notifications
- setup deploys (Capistrano, Heroku...)
- activity feed
- free for public projects
- is from Serbia :)
- http://semaphoreapp.com


Part 5: Automated code review

- test coverage
- code complexity
- code smells
- security issues
- potential vulnerabilities

Part 6: Nag people


- integration with Semaphore and CodeClimate
- increased visibility/accountability
- nags developers to solve the issues

The entire process
Next steps
- Continuous Deployment - deploy automatically after commiting to master
- Move to parallel spec execution
- Move from Capistrano to Mina for deployment (deploys are now ~4:00)
- Spin a big disco ball in the office when tests fail (using WeMo) :)
Nag me :)

Jan Varljen
jan.varljen@infinum.hr

A continuous Integration process with Ruby On Rails
RubyonRailsCI
By Jan Varljen
RubyonRailsCI
- 938