Commit 96f8172e1c46e171ef516852c3b82b4c548f7c45
1 parent
7441ba6c
Exists in
master
and in
27 other branches
ci:smoke: better output
Showing
2 changed files
with
22 additions
and
7 deletions
Show diff stats
lib/tasks/ci.rake
@@ -5,7 +5,13 @@ namespace :ci do | @@ -5,7 +5,13 @@ namespace :ci do | ||
5 | 5 | ||
6 | current_branch = `git rev-parse --abbrev-ref HEAD`.strip | 6 | current_branch = `git rev-parse --abbrev-ref HEAD`.strip |
7 | from = ENV['PREV_HEAD'] || "origin/#{current_branch}" | 7 | from = ENV['PREV_HEAD'] || "origin/#{current_branch}" |
8 | + if !system("git show-ref --verify --quiet refs/remotes/#{from}") | ||
9 | + from = 'origin/master' | ||
10 | + end | ||
8 | to = ENV['HEAD'] || current_branch | 11 | to = ENV['HEAD'] || current_branch |
12 | + | ||
13 | + puts "Testing changes between #{from} and #{to} ..." | ||
14 | + | ||
9 | changed_files = `git diff --name-only #{from}..#{to}`.split.select do |f| | 15 | changed_files = `git diff --name-only #{from}..#{to}`.split.select do |f| |
10 | File.exist?(f) && f.split(File::SEPARATOR).first != 'vendor' | 16 | File.exist?(f) && f.split(File::SEPARATOR).first != 'vendor' |
11 | end | 17 | end |
@@ -33,14 +39,23 @@ namespace :ci do | @@ -33,14 +39,23 @@ namespace :ci do | ||
33 | end | 39 | end |
34 | end | 40 | end |
35 | 41 | ||
42 | + if tests.empty? && features.empty? && changed_plugins.empty? | ||
43 | + puts "Could not figure out specific changes to be tested in isolation!" | ||
44 | + end | ||
45 | + puts | ||
46 | + | ||
36 | sh 'testrb', '-Itest', *tests unless tests.empty? | 47 | sh 'testrb', '-Itest', *tests unless tests.empty? |
37 | sh 'cucumber', *features unless features.empty? | 48 | sh 'cucumber', *features unless features.empty? |
38 | sh 'xvfb-run', 'cucumber', '-p', 'selenium', *features unless features.empty? | 49 | sh 'xvfb-run', 'cucumber', '-p', 'selenium', *features unless features.empty? |
39 | 50 | ||
40 | changed_plugins.each do |plugin| | 51 | changed_plugins.each do |plugin| |
41 | - task = "test:noosfero_plugins:#{plugin}" | ||
42 | - puts "Running #{task}" | ||
43 | - Rake::Task[task].execute | 52 | + if $broken_plugins.include?(plugin) |
53 | + puts "Skipping plugins/#{plugin}: marked as broken" | ||
54 | + else | ||
55 | + task = "test:noosfero_plugins:#{plugin}" | ||
56 | + puts "Running #{task}" | ||
57 | + Rake::Task[task].execute | ||
58 | + end | ||
44 | end | 59 | end |
45 | 60 | ||
46 | end | 61 | end |
lib/tasks/plugins_tests.rake
1 | -@broken_plugins = %w[ | 1 | +$broken_plugins = %w[ |
2 | anti_spam | 2 | anti_spam |
3 | bsc | 3 | bsc |
4 | comment_classification | 4 | comment_classification |
@@ -205,14 +205,14 @@ namespace :test do | @@ -205,14 +205,14 @@ namespace :test do | ||
205 | @all_tasks.each do |taskname| | 205 | @all_tasks.each do |taskname| |
206 | desc "Run #{taskname} tests for all plugins" | 206 | desc "Run #{taskname} tests for all plugins" |
207 | task taskname do | 207 | task taskname do |
208 | - test_sequence(@all_plugins - @broken_plugins, taskname) | 208 | + test_sequence(@all_plugins - $broken_plugins, taskname) |
209 | end | 209 | end |
210 | end | 210 | end |
211 | end | 211 | end |
212 | 212 | ||
213 | desc "Run all tests for all plugins" | 213 | desc "Run all tests for all plugins" |
214 | task :noosfero_plugins do | 214 | task :noosfero_plugins do |
215 | - test_sequence(@all_plugins - @broken_plugins, @all_tasks) do |failed| | 215 | + test_sequence(@all_plugins - $broken_plugins, @all_tasks) do |failed| |
216 | plugins_status_report(failed) | 216 | plugins_status_report(failed) |
217 | end | 217 | end |
218 | end | 218 | end |
@@ -229,7 +229,7 @@ def plugins_status_report(failed) | @@ -229,7 +229,7 @@ def plugins_status_report(failed) | ||
229 | printf ('-' * w) + ' ' + ('-' * 20) + "\n" | 229 | printf ('-' * w) + ' ' + ('-' * 20) + "\n" |
230 | 230 | ||
231 | @all_plugins.each do |plugin| | 231 | @all_plugins.each do |plugin| |
232 | - if @broken_plugins.include?(plugin) | 232 | + if $broken_plugins.include?(plugin) |
233 | status = "SKIP" | 233 | status = "SKIP" |
234 | elsif !failed[plugin] || failed[plugin].empty? | 234 | elsif !failed[plugin] || failed[plugin].empty? |
235 | status = "PASS" | 235 | status = "PASS" |