903946c78a
Colorize is a gem licensed under the GPLv2, so we can’t use it in GitLab without relicensing GitLab under the terms of the GPL. Rainbow is licensed under the MIT license and does the exact same thing as Colorize, so Rainbow was added in place of Colorize. The syntax is slightly different for Rainbow vs. Colorize, and was updated in accordance. The gem is still a dependency of Spinach, so it’s included in the development/test environments, but won’t be packaged with the actual product, and therefore doesn’t require we relicense the product. An attempt at relicensing Colorize was made, but didn’t succeed as the library owner never responded. Rainbow library: https://github.com/sickill/rainbow Relevant issue regarding licensing in GitLab's gems: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3775
62 lines
1.7 KiB
Ruby
62 lines
1.7 KiB
Ruby
Rake::Task["spinach"].clear if Rake::Task.task_defined?('spinach')
|
|
|
|
namespace :spinach do
|
|
namespace :project do
|
|
desc "GitLab | Spinach | Run project commits, issues and merge requests spinach features"
|
|
task :half do
|
|
run_spinach_tests('@project_commits,@project_issues,@project_merge_requests')
|
|
end
|
|
|
|
desc "GitLab | Spinach | Run remaining project spinach features"
|
|
task :rest do
|
|
run_spinach_tests('~@admin,~@dashboard,~@profile,~@public,~@snippets,~@project_commits,~@project_issues,~@project_merge_requests')
|
|
end
|
|
end
|
|
|
|
desc "GitLab | Spinach | Run project spinach features"
|
|
task :project do
|
|
run_spinach_tests('~@admin,~@dashboard,~@profile,~@public,~@snippets')
|
|
end
|
|
|
|
desc "GitLab | Spinach | Run other spinach features"
|
|
task :other do
|
|
run_spinach_tests('@admin,@dashboard,@profile,@public,@snippets')
|
|
end
|
|
|
|
desc "GitLab | Spinach | Run other spinach features"
|
|
task :builds do
|
|
run_spinach_tests('@builds')
|
|
end
|
|
end
|
|
|
|
desc "GitLab | Run spinach"
|
|
task :spinach do
|
|
run_spinach_tests(nil)
|
|
end
|
|
|
|
def run_command(cmd)
|
|
system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd)
|
|
end
|
|
|
|
def run_spinach_command(args)
|
|
run_command(%w(spinach -r rerun) + args)
|
|
end
|
|
|
|
def run_spinach_tests(tags)
|
|
#run_command(%w(rake gitlab:setup)) or raise('gitlab:setup failed!')
|
|
|
|
success = run_spinach_command(%W(--tags #{tags}))
|
|
3.times do |_|
|
|
break if success
|
|
break unless File.exists?('tmp/spinach-rerun.txt')
|
|
|
|
tests = File.foreach('tmp/spinach-rerun.txt').map(&:chomp)
|
|
puts ''
|
|
puts "Spinach tests for #{tags}: Retrying tests... #{tests}".color(:red)
|
|
puts ''
|
|
sleep(3)
|
|
success = run_spinach_command(tests)
|
|
end
|
|
|
|
raise("spinach tests for #{tags} failed!") unless success
|
|
end
|