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 | 5 | |
6 | 6 | current_branch = `git rev-parse --abbrev-ref HEAD`.strip |
7 | 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 | 11 | to = ENV['HEAD'] || current_branch |
12 | + | |
13 | + puts "Testing changes between #{from} and #{to} ..." | |
14 | + | |
9 | 15 | changed_files = `git diff --name-only #{from}..#{to}`.split.select do |f| |
10 | 16 | File.exist?(f) && f.split(File::SEPARATOR).first != 'vendor' |
11 | 17 | end |
... | ... | @@ -33,14 +39,23 @@ namespace :ci do |
33 | 39 | end |
34 | 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 | 47 | sh 'testrb', '-Itest', *tests unless tests.empty? |
37 | 48 | sh 'cucumber', *features unless features.empty? |
38 | 49 | sh 'xvfb-run', 'cucumber', '-p', 'selenium', *features unless features.empty? |
39 | 50 | |
40 | 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 | 59 | end |
45 | 60 | |
46 | 61 | end | ... | ... |
lib/tasks/plugins_tests.rake
1 | -@broken_plugins = %w[ | |
1 | +$broken_plugins = %w[ | |
2 | 2 | anti_spam |
3 | 3 | bsc |
4 | 4 | comment_classification |
... | ... | @@ -205,14 +205,14 @@ namespace :test do |
205 | 205 | @all_tasks.each do |taskname| |
206 | 206 | desc "Run #{taskname} tests for all plugins" |
207 | 207 | task taskname do |
208 | - test_sequence(@all_plugins - @broken_plugins, taskname) | |
208 | + test_sequence(@all_plugins - $broken_plugins, taskname) | |
209 | 209 | end |
210 | 210 | end |
211 | 211 | end |
212 | 212 | |
213 | 213 | desc "Run all tests for all plugins" |
214 | 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 | 216 | plugins_status_report(failed) |
217 | 217 | end |
218 | 218 | end |
... | ... | @@ -229,7 +229,7 @@ def plugins_status_report(failed) |
229 | 229 | printf ('-' * w) + ' ' + ('-' * 20) + "\n" |
230 | 230 | |
231 | 231 | @all_plugins.each do |plugin| |
232 | - if @broken_plugins.include?(plugin) | |
232 | + if $broken_plugins.include?(plugin) | |
233 | 233 | status = "SKIP" |
234 | 234 | elsif !failed[plugin] || failed[plugin].empty? |
235 | 235 | status = "PASS" | ... | ... |