Commit 90a9d3125508d586edbee14e18908a9f665e41d9

Authored by Antonio Terceiro
1 parent 0a886b64

Move ci run to script/ci

I wasn't able yet to figure out why the rake task was not behaving as
expected. I suspect it has to do with the order stuff is being loaded
being changed with Rails 4, but I am not sure yet. This works.
lib/tasks/selenium 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +desc 'Runs Seleniun acceptance tests'
  2 +task :selenium do
  3 + sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}"
  4 +end
... ...
lib/tasks/test.rake
No preview for this file type
script/ci 0 → 100755
... ... @@ -0,0 +1,43 @@
  1 +#!/usr/bin/env ruby
  2 +
  3 +tasks = %w[
  4 + test:units
  5 + test:functionals
  6 + test:integration
  7 + cucumber
  8 + selenium
  9 + test:noosfero_plugins
  10 +]
  11 +
  12 +data = []
  13 +failed = []
  14 +tasks.each do |task|
  15 +
  16 + puts task
  17 + puts task.gsub(/./, '-')
  18 + puts
  19 +
  20 + t0 = Time.now.to_i
  21 + if system('rake', task)
  22 + status = 'PASS'
  23 + else
  24 + failed << task
  25 + status = 'FAIL'
  26 + end
  27 + t1 = Time.now.to_i
  28 + duration = t1 - t0
  29 + data << { :name => task, :status => status, :duration => Time.at(duration).utc.strftime("%H:%M:%S") }
  30 +end
  31 +
  32 +puts
  33 +puts
  34 +printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
  35 +printf "%-30s %-6s %s\n", 'Task', 'Status', 'Duration'
  36 +printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
  37 +data.each do |entry|
  38 + printf "%-30s %-6s %s\n", entry[:name], entry[:status], entry[:duration]
  39 +end
  40 +printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
  41 +
  42 +puts
  43 +abort "Errors running #{failed.join(', ')}!" if failed.any?
... ...