Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
OrganizationEventAdvent CalendarQiitadon (β)
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at


Rails, Ruby 2.1.0, PostgreSQL, RSpec, Cucumber, PhaontomJS, HipChatの組み合わせでwerckerを使って気軽にCIする



ちなみに、Herokuなどへのdeploymentも自動化できるのですが、そのあたりのContinuous Deploymentまわりの機能は使っていません。



box: fliplingo/ubuntu12.04-ruby2.1.0@0.0.1
# Build definition
# See the Rails section on the wercker devcenter:
# http://devcenter.wercker.com/articles/languages/ruby/rails-heroku.html
# You will want to define your database as follows:
  - wercker/postgresql
# See more about services on our devcenter:
# http://devcenter.wercker.com/articles/services/
    # The steps that will be executed on build
        - script:
            name: set timezone
            code: |
                export TZ="Asia/Tokyo"
        # A step that executes `bundle install` command
        - bundle-install
        # A custom script step, name value is used in the UI
        # and the code value contains the command that get executed
        - script:
            name: echo ruby information
            code: |
                echo "ruby version $(ruby --version) running"
                echo "from location $(which ruby)"
                echo -p "gem list: $(gem list)"
        # Add more steps here:
        # A step that prepares the database.yml using the database in services
        - rails-database-yml
        # Install phantomjs
        - aussiegeek/install-phantomjs@0.0.3
        # Initialize test database
        - script:
            name: set up db
            code: |
                RAILS_ENV='test' bundle exec rake db:create
                RAILS_ENV='test' bundle exec rake db:schema:load
        # Run rspec
        - script:
            name: rspec
            code: bundle exec rspec
        # Run cucumber
        - script:
            name: cucumber
            code: bundle exec cucumber
        # Send a message to a HipChat room
        - wercker/hipchat-notify@1.0.2:
            token: $HIPCHAT_TOKEN
            room-id: 64340


  • 公式のBoxだとRuby 2.0.0なので、Ruby 2.1.0を使うためにコミュニティのBoxを使う。
  • HipChatへの通知はafter-stepsでやらないとfailしたときに通知されない。access tokenをwercker側で環境変数に設定する必要がある
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Help us understand the problem. What are the problem?