[Git][noosfero/noosfero][master] CI: Use new gitlab-ci.yml and add .travis.yml

Bráulio Bhavamitra gitlab at gitlab.com
Fri Jun 19 14:53:27 BRT 2015


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
652e8ffa by Braulio Bhavamitra at 2015-06-19T14:49:00Z
CI: Use new gitlab-ci.yml and add .travis.yml

- - - - -


6 changed files:

- + .gitlab-ci.yml
- + .travis.yml
- Gemfile
- + config/database.yml.gitlab-ci
- + config/database.yml.travis
- − script/gitlab-ci


Changes:

=====================================
.gitlab-ci.yml
=====================================
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,24 @@
+before_install:
+  - mkdir -p tmp/pids log
+  - script/noosfero-plugins disableall
+  - bundle check || bundle install
+# database
+  - cp config/database.yml.gitlab-ci config/database.yml
+  - dropdb gitlab_ci_test
+  - createdb gitlab_ci_test
+  - bundle exec rake db:schema:load
+  - bundle exec rake db:migrate
+
+units:
+  script: 'bundle exec rake test:units'
+functionals:
+  script: 'bundle exec rake test:functionals'
+integration:
+  script: 'bundle exec rake test:integration'
+cucumber:
+  script: 'bundle exec rake cucumber'
+selenium:
+  script: 'bundle exec rake selenium'
+plugins:
+  script: 'bundle exec rake test:noosfero_plugins'
+


=====================================
.travis.yml
=====================================
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,35 @@
+language: ruby
+rvm:
+# for 2.2 support we need to upgrade the pg gem
+  - 2.1.6
+
+before_install:
+# dependencies
+  - sudo apt-get update
+  - sudo apt-get -y install po4a iso-codes tango-icon-theme pidgin-data openjdk-6-jre curl wget
+  - sudo apt-get -y install libmagickwand-dev libpq-dev libreadline-dev libsqlite3-dev libxslt1-dev
+# selenium support
+  - export DISPLAY=:99.0
+  - sh -e /etc/init.d/xvfb start
+
+before_script:
+  - mkdir -p tmp/pids log
+  - script/noosfero-plugins disableall
+  - bundle check || bundle install
+# database
+  - cp config/database.yml.travis config/database.yml
+  - psql -c 'create database myapp_test;' -U postgres
+  - bundle exec rake db:schema:load
+  - bundle exec rake db:migrate
+
+env:
+  - TASK=test:units
+  - TASK=test:functionals
+  - TASK=test:integration
+  - TASK=cucumber
+  - TASK=selenium
+  - TASK=test:noosfero_plugins
+
+script:
+  - bundle exec rake $TASK
+


=====================================
Gemfile
=====================================
--- a/Gemfile
+++ b/Gemfile
@@ -32,6 +32,7 @@ group :test do
   gem 'rspec',                  '~> 2.14.0'
   gem 'rspec-rails',            '~> 2.14.1'
   gem 'mocha',                  '~> 1.1.0', :require => false
+  gem 'test-unit' if RUBY_VERSION >= '2.2.0'
 end
 
 group :cucumber do


=====================================
config/database.yml.gitlab-ci
=====================================
--- /dev/null
+++ b/config/database.yml.gitlab-ci
@@ -0,0 +1,5 @@
+# From http://about.travis-ci.org/docs/user/database-setup/
+test:
+  adapter: postgresql
+  database: gitlab_ci_test
+  username: postgres


=====================================
config/database.yml.travis
=====================================
--- /dev/null
+++ b/config/database.yml.travis
@@ -0,0 +1,5 @@
+# From http://about.travis-ci.org/docs/user/database-setup/
+test:
+  adapter: postgresql
+  database: myapp_test
+  username: postgres


=====================================
script/gitlab-ci deleted
=====================================
--- a/script/gitlab-ci
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env ruby
-
-# These just forward the signals to the whole process group and
-# then immediately exit.
-pgid = Process.getpgid Process.pid
-Signal.trap(:TERM) { Process.kill(:TERM, -pgid); exit }
-Signal.trap(:INT)  { Process.kill(:INT,  -pgid); exit }
-
-def run command, options = {}
-  command = "#{command} 2>&1 > /dev/null" if options[:output] == false
-  #command = "time #{command}" unless options[:runtime] == false
-  puts "== #{command}"
-  system command
-end
-
- at id = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
- at db = "gitlab-ci-#{@id}"
-
-def config
-  require 'yaml'
-  db_config = {
-    'adapter' => 'postgresql', 'encoding' => 'unicode', 
-    'database' => @db, 'username' => ENV['USER'],
-  }
-  File.write 'config/database.yml', YAML.dump('test' => db_config, 'development' => db_config)
-end
-
-def prepare
-  run("createdb #{@db}") and
-  run('mkdir -p tmp/pids log') and
-  run('bundle check || bundle install') and
-  run('rake db:schema:load', output: false) and
-  run('script/noosfero-plugins disableall') and
-  run('rake db:migrate')
-end
-
-def test
-  %w[
-    test:units
-    test:functionals
-    test:integration
-    cucumber 
-    test:noosfero_plugins
-  ].each do |task|
-    run "rake #{task}"
-  end
-end
-
-def cleanup
-  run "dropdb #{@db}"
-end
-
-ret = config and prepare and test
-cleanup
-
-exit (if ret == true then 0 else 1 end)



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/652e8ffa4cffd00a34a5eb262ad725b3dc1064eb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150619/ecd6c149/attachment.html>


More information about the Noosfero-dev mailing list