RailsでTravis CI使うメモ
GitHub側の準備
個人のリポジトリだとTravis CIにログインした時点で読み込まれるけど,チーム(Organization)だと自分で設定する必要があるみたい.
GitHubリポジトリの Settings → Webhooks & Services → Services
にTravisのUserとTokenを入力して追加する.
(TokenはTravisの Accounts → Profile で見られる.)
.travis.yml
Travisはリポジトリ直下の.travis.ymlに書いた設定に従ってテストする.
今回はRails用に以下のように書いてみた.
language: ruby rvm: - 2.1.2 bundler_args: --without development env: - DB=postgresql before_script: - cp config/database.yml.travis config/database.yml script: - bundle exec rake db:drop db:create db:migrate db:seed - bundle exec rake spec notifications: email: false
自分でTravisの設定書くのは初めてなので,無駄とか不足があるかも.
config/database.yml.travisでは,usernameとpasswordは空にしておく.