aboutsummaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorChad Woolley <thewoolleyman@gmail.com>2008-08-24 16:25:05 +0200
committerMichael Koziarski <michael@koziarski.com>2008-08-24 16:27:20 +0200
commit337b043c9373014b034b79c487f70594ebb6a910 (patch)
treede8454196191ac8d59ab1c41e8e1d99947fa4dd0 /ci
parent33ed19f428953e2a372345e39ae2b37353a9e9da (diff)
downloadrails-337b043c9373014b034b79c487f70594ebb6a910.tar.gz
rails-337b043c9373014b034b79c487f70594ebb6a910.tar.bz2
rails-337b043c9373014b034b79c487f70594ebb6a910.zip
Include the CI configuration and setup instructions.
This should make it easy to set up your own copy of the CI environment, and easier for us to keep ours running.
Diffstat (limited to 'ci')
-rwxr-xr-xci/ci_build.rb117
-rw-r--r--ci/ci_setup_notes.txt120
-rw-r--r--ci/cruise_config.rb5
-rw-r--r--ci/geminstaller.yml17
-rw-r--r--ci/site.css13
-rw-r--r--ci/site_config.rb72
6 files changed, 344 insertions, 0 deletions
diff --git a/ci/ci_build.rb b/ci/ci_build.rb
new file mode 100755
index 0000000000..049f7b7975
--- /dev/null
+++ b/ci/ci_build.rb
@@ -0,0 +1,117 @@
+#!/usr/bin/env ruby
+require 'fileutils'
+
+include FileUtils
+
+puts "[CruiseControl] Rails build"
+
+build_results = {}
+root_dir = File.expand_path(File.dirname(__FILE__) + "/..")
+
+# Requires gem home and path to be writeable and/or overridden to be ~/.gem,
+# Will enable when RubyGems supports this properly (in a coming release)
+# build_results[:geminstaller] = system 'geminstaller --exceptions'
+
+# for now, use the no-passwd sudoers approach (documented in ci_setup_notes.txt)
+# A security hole, but there is nothing valuable on rails CI box anyway.
+build_results[:geminstaller] = system 'sudo geminstaller --exceptions'
+
+cd "#{root_dir}/activesupport" do
+ puts
+ puts "[CruiseControl] Building ActiveSupport"
+ puts
+ build_results[:activesupport] = system 'rake'
+end
+
+cd "#{root_dir}/activerecord" do
+ puts
+ puts "[CruiseControl] Building ActiveRecord with MySQL"
+ puts
+ build_results[:activerecord_mysql] = system 'rake test_mysql'
+end
+
+# Postgres is disabled until tests are fixed
+# cd "#{root_dir}/activerecord" do
+# puts
+# puts "[CruiseControl] Building ActiveRecord with PostgreSQL"
+# puts
+# build_results[:activerecord_postgresql8] = system 'rake test_postgresql'
+# end
+
+# Sqlite2 is disabled until tests are fixed
+# cd "#{root_dir}/activerecord" do
+# puts
+# puts "[CruiseControl] Building ActiveRecord with SQLite 2"
+# puts
+# build_results[:activerecord_sqlite] = system 'rake test_sqlite'
+# end
+
+cd "#{root_dir}/activerecord" do
+ puts
+ puts "[CruiseControl] Building ActiveRecord with SQLite 3"
+ puts
+ build_results[:activerecord_sqlite3] = system 'rake test_sqlite3'
+end
+
+cd "#{root_dir}/activemodel" do
+ puts
+ puts "[CruiseControl] Building ActiveModel"
+ puts
+ build_results[:activemodel] = system 'rake'
+end
+
+cd "#{root_dir}/activeresource" do
+ puts
+ puts "[CruiseControl] Building ActiveResource"
+ puts
+ build_results[:activeresource] = system 'rake'
+end
+
+cd "#{root_dir}/actionpack" do
+ puts
+ puts "[CruiseControl] Building ActionPack"
+ puts
+ build_results[:actionpack] = system 'rake'
+end
+
+cd "#{root_dir}/actionmailer" do
+ puts
+ puts "[CruiseControl] Building ActionMailer"
+ puts
+ build_results[:actionmailer] = system 'rake'
+end
+
+cd "#{root_dir}/railties" do
+ puts
+ puts "[CruiseControl] Building RailTies"
+ puts
+ build_results[:railties] = system 'rake'
+end
+
+
+puts
+puts "[CruiseControl] Build environment:"
+puts "[CruiseControl] #{`cat /etc/issue`}"
+puts "[CruiseControl] #{`uname -a`}"
+puts "[CruiseControl] #{`ruby -v`}"
+puts "[CruiseControl] #{`mysql --version`}"
+puts "[CruiseControl] #{`pg_config --version`}"
+puts "[CruiseControl] SQLite2: #{`sqlite -version`}"
+puts "[CruiseControl] SQLite3: #{`sqlite3 -version`}"
+`gem env`.each {|line| print "[CruiseControl] #{line}"}
+puts "[CruiseControl] Local gems:"
+`gem list`.each {|line| print "[CruiseControl] #{line}"}
+
+failures = build_results.select { |key, value| value == false }
+
+if failures.empty?
+ puts
+ puts "[CruiseControl] Rails build finished sucessfully"
+ exit(0)
+else
+ puts
+ puts "[CruiseControl] Rails build FAILED"
+ puts "[CruiseControl] Failed components: #{failures.map { |component| component.first }.join(', ')}"
+ exit(-1)
+end
+
diff --git a/ci/ci_setup_notes.txt b/ci/ci_setup_notes.txt
new file mode 100644
index 0000000000..86df33c443
--- /dev/null
+++ b/ci/ci_setup_notes.txt
@@ -0,0 +1,120 @@
+# Rails Continuous Integration Server Setup Notes
+# This procedure was used to set up http://ci.rubyonrails.org on Ubuntu 8.04
+# It can be used as a guideline for setting up your own CI server against your local rails branches
+
+* Set up ci user:
+# log in as root
+$ adduser ci
+enter user info and password
+$ visudo
+# give ci user same sudo rights as root
+
+* Disable root login:
+# log in as ci
+$ sudo vi /etc/shadow
+# overwrite and disable encrypted root password to disable root login:
+root:*:14001:0:99999:7:::
+
+* Change Hostname:
+$ sudo vi /etc/hostname
+change to 'ci'
+$ sudo vi /etc/hosts
+replace old hostname with 'ci'
+# reboot to use new hostname (and test reboot)
+$ sudo shutdown -r now
+
+* Update aptitude:
+$ sudo aptitude update
+
+* Use cinabox to perform rest of ruby/ccrb setup:
+* http://github.com/thewoolleyman/cinabox/tree/master/README.txt
+
+# This is not yet properly supported by RubyGems...
+# * Configure RubyGems to not require root access for gem installation
+# $ vi ~/.profile
+# # add this line at bottom:
+# PATH="$HOME/.gem/ruby/1.8/bin:$PATH"
+# $ sudo vi /etc/init.d/cruise
+# # edit the start_cruise line to source CRUISE_USER/.profile:
+# start_cruise "cd #{CRUISE_HOME} && source /home/#{CRUISE_USER}/.profile && ./cruise start -d"
+# $ vi ~/.gemrc
+# # add these lines:
+# ---
+# gemhome: /home/ci/.gem/ruby/1.8
+# gempath:
+# - /home/ci/.gem/ruby/1.8
+
+* If you did not configure no-root-gem installation via ~/.gemrc as shown above, then allow no-password sudo for gem installation:
+$ sudo visudo
+# add this line to bottom:
+ci ALL=NOPASSWD: /usr/local/bin/geminstaller, /usr/local/bin/ruby, /usr/local/bin/gem
+
+* Start ccrb via init script and check for default homepage at port 3333
+
+* Install/setup nginx:
+$ sudo aptitude install nginx
+$ sudo vi /etc/nginx/sites-available/default
+# comment two lines and add one to proxy to ccrb:
+# root /var/www/nginx-default;
+# index index.html index.htm;
+ proxy_pass http://127.0.0.1:3333;
+$ sudo /etc/init.d/nginx start
+
+* Add project to cruise (It will still fail until everything is set up):
+$ cd ~/ccrb
+$ ./cruise add rails -s git -r git://github.com/rails/rails.git # or the URI of your branch
+
+* Copy and configure cruise site config file:
+$ cp ~/.cruise/projects/rails/work/ci/site_config.rb ~/.cruise/site_config.rb
+# Edit ~/.cruise/site_config.rb as desired, for example:
+ActionMailer::Base.smtp_settings = {
+ :address => "localhost",
+ :domain => "ci.yourdomain.com",
+}
+Configuration.dashboard_refresh_interval = 60.seconds
+Configuration.dashboard_url = 'http://ci.yourdomain.com/'
+Configuration.serialize_builds = true
+Configuration.serialized_build_timeout = 1.hours
+BuildReaper.number_of_builds_to_keep = 100
+
+* Copy and configure cruise project config file
+$ cp ~/.cruise/projects/rails/work/ci/cruise_config.rb ~/.cruise/projects/rails
+$ vi ~/.cruise/projects/rails/cruise_config.rb:
+# Edit ~/.cruise/projects/rails/cruise_config.rb as desired, for example:
+Project.configure do |project|
+ project.build_command = 'ruby ci/ci_build.rb'
+ project.email_notifier.emails = ['recipient@yourdomain.com']
+ project.email_notifier.from = 'sender@yourdomain.com'
+end
+
+* Set up mysql
+$ sudo aptitude install mysql-server-5.0 libmysqlclient-dev
+# no password for mysql root user
+
+* setup sqlite
+$ sudo aptitude install sqlite sqlite3 libsqlite-dev libsqlite3-dev
+# Note: there's some installation bugs with sqlite3-ruby 1.2.2 gem file permissions:
+# http://www.icoretech.org/2008/07/06/no-such-file-to-load-sqlite3-database
+# cd /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2 && sudo find . -perm 0662 -exec chmod 664 {} \;
+
+* setup postgres
+$ sudo aptitude install postgresql postgresql-server-dev-8.3
+$ sudo su - postgres -c 'createuser -s ci'
+
+* Install and run GemInstaller to get all dependency gems
+$ sudo gem install geminstaller
+$ cd ~/.cruise/projects/rails/work
+$ sudo geminstaller --config=ci/geminstaller.yml # turn up debugging with these options: --geminstaller-output=all --rubygems-output=all
+
+* Create ActiveRecord test databases for mysql
+$ mysql -uroot -e 'grant all on *.* to rails@localhost;'
+$ mysql -urails -e 'create database activerecord_unittest;'
+$ mysql -urails -e 'create database activerecord_unittest2;'
+
+* Create ActiveRecord test databases for postgres
+# cd to rails activerecord dir
+$ rake postgresql:build_databases
+
+* Reboot and make sure everything is working
+$ sudo shutdown -r now
+$ http://ci.yourdomain.com \ No newline at end of file
diff --git a/ci/cruise_config.rb b/ci/cruise_config.rb
new file mode 100644
index 0000000000..ec1c82a8bf
--- /dev/null
+++ b/ci/cruise_config.rb
@@ -0,0 +1,5 @@
+Project.configure do |project|
+ project.build_command = 'ruby ci/ci_build.rb'
+ project.email_notifier.emails = ['thewoolleyman@gmail.com','michael@koziarski.com']
+ project.email_notifier.from = 'thewoolleyman+railsci@gmail.com'
+end
diff --git a/ci/geminstaller.yml b/ci/geminstaller.yml
new file mode 100644
index 0000000000..3a1862c3c3
--- /dev/null
+++ b/ci/geminstaller.yml
@@ -0,0 +1,17 @@
+---
+gems:
+- name: geminstaller
+ version: >= 0.4.3
+- name: mocha
+ version: >= 0.9.0
+- name: mysql
+ #version: >= 2.7
+ version: = 2.7
+- name: postgres
+ version: >= 0.7.9.2008.01.28
+- name: rake
+ version: >= 0.8.1
+- name: sqlite-ruby
+ version: >= 2.2.3
+- name: sqlite3-ruby
+ version: >= 1.2.2
diff --git a/ci/site.css b/ci/site.css
new file mode 100644
index 0000000000..e771c5d1fd
--- /dev/null
+++ b/ci/site.css
@@ -0,0 +1,13 @@
+/* this is a copy of /home/ci/.cruise/site.css, please make any changes to it there */
+
+/* this is a copy of /home/ci/.cruise/site.css, please make any changes to it there */
+
+/* if you'd like to add custom styles to cruise, add them here */
+/* the following will make successful builds green */
+a.success, a.success:visited {
+ color: #0A0;
+}
+
+.build_success {
+ background-image: url(/images/green_gradient.png);
+}
diff --git a/ci/site_config.rb b/ci/site_config.rb
new file mode 100644
index 0000000000..47b7e92120
--- /dev/null
+++ b/ci/site_config.rb
@@ -0,0 +1,72 @@
+# site_config.rb contains examples of various configuration options for the local installation
+# of CruiseControl.rb.
+
+# YOU MUST RESTART YOUR CRUISE CONTROL SERVER FOR ANY CHANGES MADE HERE TO TAKE EFFECT!!!
+
+# EMAIL NOTIFICATION
+# ------------------
+
+# CruiseControl.rb can notify you about build status via email. It uses ActionMailer component of Ruby on Rails
+# framework. Obviously, ActionMailer needs to know how to send out email messages.
+# If you have an SMTP server on your network, and it needs no authentication, write this in your site_config.rb:
+#
+ActionMailer::Base.smtp_settings = {
+ :address => "localhost",
+ :domain => "ci.rubyonrails.org",
+}
+#
+# If you have no SMTP server at hand, you can configure email notification to use GMail SMTP server, as follows
+# (of course, you'll need to create a GMail account):
+#
+# ActionMailer::Base.smtp_settings = {
+# :address => "smtp.gmail.com",
+# :port => 587,
+# :domain => "yourdomain.com",
+# :authentication => :plain,
+# :user_name => "yourgmailaccount",
+# :password => "yourgmailpassword"
+# }
+#
+# The same approach works for other SMTP servers thet require authentication. Note that GMail's SMTP server runs on a
+# non-standard port 587 (standard port for SMTP is 25).
+#
+# For further details about configuration of outgoing email, see Ruby On Rails documentation for ActionMailer::Base.
+
+# Other site-wide options are available through Configuration class:
+
+# Change how often CC.rb pings Subversion for new requests. Default is 10.seconds, which should be OK for a local
+# SVN repository, but probably isn't very polite for a public repository, such as RubyForge. This can also be set for
+# each project individually, through project.scheduler.polling_interval option:
+# Configuration.default_polling_interval = 1.minute
+
+# How often the dashboard page refreshes itself. If you have more than 10-20 dashboards open,
+# it is advisable to set it to something higher than the default 5 seconds:
+Configuration.dashboard_refresh_interval = 60.seconds
+
+# Site-wide setting for the email "from" field. This can also be set on per-project basis,
+# through project.email.notifier.from attribute
+Configuration.email_from = 'thewoolleyman+railsci@gmail.com'
+
+# Root URL of the dashboard application. Setting this attribute allows various notifiers to include a link to the
+# build page in the notification message.
+Configuration.dashboard_url = 'http://ci.rubyonrails.org/'
+
+# If you don't want to allow triggering builds through dashboard Build Now button. Useful when you host CC.rb as a
+# public web site (such as http://cruisecontrolrb.thoughtworks.com/projects - try clicking on Build Now button there
+# and see what happens):
+# Configuration.disable_build_now = true
+
+# If you want to only allow one project to build at a time, uncomment this line
+# by default, cruise allows multiple projects to build at a time
+Configuration.serialize_builds = true
+
+# Amount of time a project will wait to build before failing when build serialization is on
+Configuration.serialized_build_timeout = 3.hours
+
+# To delete build when there are more than a certain number present, uncomment this line - it will make the dashboard
+# perform better
+BuildReaper.number_of_builds_to_keep = 100
+
+# any files that you'd like to override in cruise, keep in ~/.cruise, and copy over when this file is loaded like this
+site_css = CRUISE_DATA_ROOT + "/site.css"
+FileUtils.cp site_css, RAILS_ROOT + "/public/stylesheets/site.css" if File.exists? site_css