noosfero | ci:smoke: better output

Antonio Terceiro gitlab at gitlab.com
Wed Jan 28 16:48:10 BRST 2015


Antonio Terceiro pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>

Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/96f8172e1c46e171ef516852c3b82b4c548f7c45">96f8172e</a> by Antonio Terceiro
ci:smoke: better output

- - - - -


Changes:

=====================================
lib/tasks/ci.rake
=====================================
--- a/lib/tasks/ci.rake
+++ b/lib/tasks/ci.rake
@@ -5,7 +5,13 @@ namespace :ci do
 
     current_branch = `git rev-parse --abbrev-ref HEAD`.strip
     from = ENV['PREV_HEAD'] || "origin/#{current_branch}"
+    if !system("git show-ref --verify --quiet refs/remotes/#{from}")
+      from = 'origin/master'
+    end
     to = ENV['HEAD'] || current_branch
+
+    puts "Testing changes between #{from} and #{to} ..."
+
     changed_files = `git diff --name-only #{from}..#{to}`.split.select do |f|
       File.exist?(f) && f.split(File::SEPARATOR).first != 'vendor'
     end
@@ -33,14 +39,23 @@ namespace :ci do
       end
     end
 
+    if tests.empty? && features.empty? && changed_plugins.empty?
+      puts "Could not figure out specific changes to be tested in isolation!"
+    end
+    puts
+
     sh 'testrb', '-Itest', *tests unless tests.empty?
     sh 'cucumber', *features unless features.empty?
     sh 'xvfb-run', 'cucumber', '-p', 'selenium', *features unless features.empty?
 
     changed_plugins.each do |plugin|
-      task = "test:noosfero_plugins:#{plugin}"
-      puts "Running #{task}"
-      Rake::Task[task].execute
+      if $broken_plugins.include?(plugin)
+        puts "Skipping plugins/#{plugin}: marked as broken"
+      else
+        task = "test:noosfero_plugins:#{plugin}"
+        puts "Running #{task}"
+        Rake::Task[task].execute
+      end
     end
 
   end

=====================================
lib/tasks/plugins_tests.rake
=====================================
--- a/lib/tasks/plugins_tests.rake
+++ b/lib/tasks/plugins_tests.rake
@@ -1,4 +1,4 @@
- at broken_plugins = %w[
+$broken_plugins = %w[
   anti_spam
   bsc
   comment_classification
@@ -205,14 +205,14 @@ namespace :test do
     @all_tasks.each do |taskname|
       desc "Run #{taskname} tests for all plugins"
       task taskname do
-        test_sequence(@all_plugins - @broken_plugins, taskname)
+        test_sequence(@all_plugins - $broken_plugins, taskname)
       end
     end
   end
 
   desc "Run all tests for all plugins"
   task :noosfero_plugins do
-    test_sequence(@all_plugins - @broken_plugins, @all_tasks) do |failed|
+    test_sequence(@all_plugins - $broken_plugins, @all_tasks) do |failed|
       plugins_status_report(failed)
     end
   end
@@ -229,7 +229,7 @@ def plugins_status_report(failed)
   printf ('-' * w) + ' ' + ('-' * 20) + "\n"
 
   @all_plugins.each do |plugin|
-    if @broken_plugins.include?(plugin)
+    if $broken_plugins.include?(plugin)
       status = "SKIP"
     elsif !failed[plugin] || failed[plugin].empty?
       status = "PASS"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150128/b0404eb3/attachment.html>


More information about the Noosfero-dev mailing list